@minecraft-docker/mcctl-console 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +34 -34
- package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +21 -21
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/354.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5843.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7573.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8243.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-2ec271596e09c5f1.js +1 -0
- package/.next/static/chunks/app/(main)/servers/[name]/page-2ec271596e09c5f1.js +1 -0
- package/package.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-ab34db97055578dd.js +0 -1
- package/.next/static/chunks/app/(main)/servers/[name]/page-ab34db97055578dd.js +0 -1
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{fdYvEyTkN35IFbAO8RHVv → vFi0GyYVE0v9zPFVmRQHq}/_buildManifest.js +0 -0
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{fdYvEyTkN35IFbAO8RHVv → vFi0GyYVE0v9zPFVmRQHq}/_ssgManifest.js +0 -0
- /package/.next/static/{fdYvEyTkN35IFbAO8RHVv → vFi0GyYVE0v9zPFVmRQHq}/_buildManifest.js +0 -0
- /package/.next/static/{fdYvEyTkN35IFbAO8RHVv → vFi0GyYVE0v9zPFVmRQHq}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,t,r){Promise.resolve().then(r.bind(r,46812))},46812:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return to}});var s=r(94655),n=r(35106),i=r(74228),a=r(31358),l=r(7281),o=r(30417),d=r(79983),c=r(81071),x=r(93017),u=r(10721),h=r(628),p=r(41565),m=r(31317),v=r(35694),y=r(7178),j=r(17820),g=r(73424),b=r(99770),f=r(62508),Z=r(5682),w=r(76678),C=r(97436),S=r(84840),k=r(76492),R=r(10117),T=r(5501),I=r(37809),z=r(21111),F=r(17978),P=r(89573),W=r(96292),A=r(33104),M=r(25333),D=r(52082),O=r(69123),E=r(71185),q=r(30165),N=r(97293),B=r(11259),U=r(66615),L=r(89161),H=r(34071),K=r(4405);function G(e){let{value:t,unit:r,label:n,icon:i,progress:a,progressMax:o,color:d="#1bd96a"}=e;return(0,s.jsxs)(h.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,s.jsx)(m.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",fontFamily:"'JetBrains Mono', 'Fira Code', monospace",letterSpacing:"-0.5px"},children:t}),(0,s.jsx)(m.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:r})]}),(0,s.jsx)(l.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,s.jsx)(m.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:n}),(0,s.jsx)(K.Z,{variant:"determinate",value:Math.min(a/o*100,100),sx:{mt:1,height:6,borderRadius:1.5,bgcolor:"#2a2d3a","& .MuiLinearProgress-bar":{borderRadius:1.5,background:"linear-gradient(90deg, ".concat(d," 0%, ").concat(d,"cc 100%)")}}})]})}var V=r(163),J=r(73660),Q=r(90158),_=r(58347),X=r(95511),$=r(46725),Y=r(26577),ee=r(56813),et=r(26892),er=r(84509);function es(e){var t;let{serverName:r}=e,{data:n,isLoading:i,error:a}=(0,er.HZ)(r,{limit:20});if(i)return(0,s.jsx)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:60,height:24}),(0,s.jsx)(u.Z,{variant:"text",width:"60%"}),(0,s.jsx)(u.Z,{variant:"text",width:50})]},t))});if(a)return(0,s.jsxs)(c.Z,{severity:"error",children:["Failed to load activity: ",a.message]});let d=null!==(t=null==n?void 0:n.logs)&&void 0!==t?t:[];if(0===d.length)return(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"No activity recorded for this server yet."});let x="/audit-logs?targetType=server&targetName=".concat(encodeURIComponent(r));return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(Q.Z,{sx:{py:0},children:d.map(e=>{var t;return(0,s.jsx)(_.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,s.jsx)(g.Z,{primary:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(ee.I,{action:e.action,size:"small"}),(0,s.jsxs)(m.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),(0,s.jsx)(et.c,{status:e.status,size:"small"})]}),secondary:(0,s.jsx)(X.Z,{title:(t=e.timestamp,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}).format(new Date(t))),arrow:!0,children:(0,s.jsx)(m.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let t=new Date,r=new Date(e),s=Math.floor((t.getTime()-r.getTime())/6e4),n=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(e.timestamp)})})})},e.id)})}),(0,s.jsx)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,s.jsx)(o.Z,{component:$.default,href:x,size:"small",endIcon:(0,s.jsx)(Y.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var en=r(37530),ei=r(84420),ea=r(46121),el=r(84775),eo=r(92666),ed=r(70115),ec=r(70603),ex=r(32366),eu=r(5942),eh=r(25523);function ep(e){let{serverName:t}=e,{data:r,isLoading:i}=(0,eo.Js)(t),a=(0,eo.Bx)(),[u,v]=(0,n.useState)([]),[y,j]=(0,n.useState)(!1),[g,b]=(0,n.useState)(!1),[f,Z]=(0,n.useState)(""),[w,S]=(0,n.useState)(""),[k,R]=(0,n.useState)(!1),[T,I]=(0,n.useState)({open:!1,message:"",severity:"success"});(0,n.useEffect)(()=>{(null==r?void 0:r.customHostnames)&&(v(r.customHostnames),j(!1),R(!1))},[r]);let F=e=>{let t=e.trim().toLowerCase();return t?t.length>253?"Domain exceeds 253 characters":/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/.test(t)?t.endsWith(".local")?"Cannot use .local system domain":t.endsWith(".nip.io")?"Cannot use .nip.io system domain":u.includes(t)?"Domain already exists":"":"Invalid domain format":"Domain cannot be empty"},P=()=>{let e=f.trim().toLowerCase(),t=F(e);if(t){S(t);return}v(t=>[...t,e]),Z(""),S(""),b(!1),j(!0)},W=e=>{v(t=>t.filter(t=>t!==e)),j(!0)},A=async()=>{try{await a.mutateAsync({serverName:t,customHostnames:u}),j(!1),R(!0),I({open:!0,message:"Hostnames saved. Container recreation required to apply changes.",severity:"warning"})}catch(e){I({open:!0,message:e instanceof Error?e.message:"Failed to save hostnames",severity:"error"})}},D=()=>{b(!1),Z(""),S("")};return i?(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsx)(p.Z,{children:(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(x.Z,{size:24})})})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,s.jsx)(eh.Z,{color:"primary"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Hostnames / Domains"})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Manage hostnames used by mc-router to route connections to this server."}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(null==r?void 0:r.systemHostnames)&&r.systemHostnames.length>0&&(0,s.jsxs)(l.Z,{sx:{mb:3},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"System Hostnames (read-only)"}),(0,s.jsx)(ed.Z,{direction:"row",flexWrap:"wrap",gap:1,children:r.systemHostnames.map(e=>(0,s.jsx)(M.Z,{icon:(0,s.jsx)(ec.Z,{sx:{fontSize:16}}),label:e.hostname,title:e.description,variant:"outlined",color:"default",size:"small"},e.hostname))})]}),(0,s.jsxs)(l.Z,{sx:{mb:2},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"Custom Domains"}),0===u.length&&!g&&(0,s.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mb:1},children:"No custom domains configured."}),(0,s.jsx)(ed.Z,{spacing:1,children:u.map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5,px:1.5,borderRadius:1,bgcolor:"action.hover"},children:[(0,s.jsx)(m.Z,{variant:"body2",fontFamily:"monospace",children:e}),(0,s.jsx)(d.Z,{size:"small",color:"error",onClick:()=>W(e),title:"Remove domain",children:(0,s.jsx)(z.Z,{fontSize:"small"})})]},e))}),g?(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"flex-start",gap:1,mt:1},children:[(0,s.jsx)(C.Z,{size:"small",placeholder:"e.g. play.example.com",value:f,onChange:e=>{Z(e.target.value),S("")},onKeyDown:e=>{"Enter"===e.key&&P(),"Escape"===e.key&&D()},error:!!w,helperText:w,autoFocus:!0,sx:{flex:1}}),(0,s.jsx)(o.Z,{size:"small",variant:"contained",onClick:P,children:"Add"}),(0,s.jsx)(d.Z,{size:"small",onClick:D,children:(0,s.jsx)(E.Z,{fontSize:"small"})})]}):(0,s.jsx)(o.Z,{size:"small",startIcon:(0,s.jsx)(ex.Z,{}),onClick:()=>b(!0),sx:{mt:1},children:"Add Domain"})]}),k&&(0,s.jsxs)(c.Z,{severity:"warning",sx:{mb:2},children:["Container recreation is required for hostname changes to take effect. Run ",(0,s.jsx)("code",{children:"docker compose up -d"})," or restart the server from the dashboard."]}),(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(eu.Z,{}),onClick:A,disabled:!y||a.isPending,children:a.isPending?"Saving...":"Save Hostnames"})})]})}),(0,s.jsx)(en.Z,{open:T.open,autoHideDuration:6e3,onClose:()=>I({...T,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,s.jsx)(c.Z,{onClose:()=>I({...T,open:!1}),severity:T.severity,sx:{width:"100%"},children:T.message})})]})}var em=r(87716),ev=r(81960),ey=r(62328),ej=r(29793),eg=r(75726),eb=r(40064),ef=r(38393),eZ=r(28058),ew=r(42730);function eC(e){var t;let{field:r,value:i,onChange:a}=e,[o,c]=(0,n.useState)(!1),x=null!==(t=r.columns)&&void 0!==t?t:6,u=r.restartRequired?(0,s.jsx)(M.Z,{icon:(0,s.jsx)(el.Z,{sx:{fontSize:14}}),label:"Restart",size:"small",sx:{ml:1,height:20,fontSize:11,color:"warning.main",borderColor:"warning.main","& .MuiChip-icon":{color:"warning.main"}},variant:"outlined"}):null;return(0,s.jsx)(S.ZP,{item:!0,xs:12,sm:x,children:(()=>{var e,t,n,x,h,p;switch(r.type){case"boolean":return(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,s.jsx)(eb.Z,{control:(0,s.jsx)(ef.Z,{checked:null!=i&&i,onChange:e=>a(r.key,e.target.checked)}),label:r.label}),u]}),r.helperText&&(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:4,display:"block"},children:r.helperText})]});case"select":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsxs)(ej.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(eg.Z,{children:r.label}),(0,s.jsx)(ey.Z,{value:null!==(x=null!=i?i:null===(t=r.options)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.value)&&void 0!==x?x:"",label:r.label,onChange:e=>a(r.key,e.target.value),children:null===(n=r.options)||void 0===n?void 0:n.map(e=>(0,s.jsx)(y.Z,{value:e.value,children:e.label},e.value))})]})]});case"number":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",type:"number",label:r.label,value:null!=i?i:"",onChange:e=>{let t=e.target.value;a(r.key,""===t?void 0:parseInt(t,10))},inputProps:{min:null===(h=r.validation)||void 0===h?void 0:h.min,max:null===(p=r.validation)||void 0===p?void 0:p.max},helperText:r.helperText,InputProps:r.unit?{endAdornment:(0,s.jsx)(D.Z,{position:"end",children:(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:r.unit})})}:void 0})]});case"password":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",type:o?"text":"password",label:r.label,value:null!=i?i:"",onChange:e=>a(r.key,e.target.value),helperText:r.helperText,InputProps:{endAdornment:(0,s.jsx)(D.Z,{position:"end",children:(0,s.jsx)(d.Z,{size:"small",onClick:()=>c(!o),edge:"end",children:o?(0,s.jsx)(ew.Z,{fontSize:"small"}):(0,s.jsx)(eZ.Z,{fontSize:"small"})})})}})]});default:return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",label:r.label,value:null!=i?i:"",onChange:e=>a(r.key,e.target.value),helperText:r.helperText})]})}})()})}function eS(e){let{section:t,values:r,onChange:i}=e,[a,d]=(0,n.useState)(!1),c=t.icon,x=t.advancedFields.length;return(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsxs)(p.Z,{sx:{p:3},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1},children:[(0,s.jsx)(c,{sx:{fontSize:22,color:"primary.main"}}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:t.title})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t.description}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(0,s.jsx)(S.ZP,{container:!0,spacing:2.5,children:t.essentialFields.map(e=>(0,s.jsx)(eC,{field:e,value:r[e.key],onChange:i},e.key))}),x>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.Z,{fullWidth:!0,variant:"text",onClick:()=>d(!a),endIcon:(0,s.jsx)(ev.Z,{sx:{transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s"}}),sx:{mt:2.5,justifyContent:"flex-start",color:"text.secondary",textTransform:"none",py:1,"&:hover":{bgcolor:"action.hover"}},children:[a?"Hide":"Show"," Advanced Settings (",x,")"]}),(0,s.jsx)(em.Z,{in:a,timeout:300,children:(0,s.jsx)(l.Z,{sx:{pt:2,borderTop:"1px dashed",borderColor:"divider"},children:(0,s.jsx)(S.ZP,{container:!0,spacing:2.5,children:t.advancedFields.map(e=>(0,s.jsx)(eC,{field:e,value:r[e.key],onChange:i},e.key))})})})]})]})})}var ek=r(12550);function eR(e){let{hasChanges:t,changedCount:r,hasRestartChanges:n,isSaving:i,onSave:a,onDiscard:d}=e;return(0,s.jsx)(ek.Z,{direction:"up",in:t,mountOnEnter:!0,unmountOnExit:!0,children:(0,s.jsxs)(l.Z,{sx:{position:"sticky",bottom:0,zIndex:1100,bgcolor:"background.paper",borderTop:2,borderColor:"primary.main",px:3,py:2,mx:-3,mb:-3,boxShadow:"0 -4px 20px rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[n&&(0,s.jsx)(el.Z,{sx:{color:"warning.main",fontSize:20}}),(0,s.jsxs)(m.Z,{variant:"body2",fontWeight:600,children:[r," unsaved change",1!==r?"s":""]}),n&&(0,s.jsx)(m.Z,{variant:"caption",color:"warning.main",children:"(some require restart)"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1},children:[(0,s.jsx)(o.Z,{variant:"text",color:"inherit",onClick:d,disabled:i,children:"Discard"}),(0,s.jsx)(o.Z,{variant:"contained",startIcon:i?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(eu.Z,{}),onClick:a,disabled:i,children:i?"Saving...":"Save Changes (".concat(r,")")})]})]})})}function eT(e){let{open:t,changedFields:r,onSaveOnly:n,onSaveAndRestart:i,onCancel:a}=e;return(0,s.jsxs)(b.Z,{open:t,onClose:a,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(el.Z,{color:"warning"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Restart Required"})]})}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(m.Z,{variant:"body1",gutterBottom:!0,children:"The following changes require a server restart to take effect:"}),(0,s.jsx)(Q.Z,{dense:!0,children:r.map(e=>(0,s.jsx)(_.ZP,{sx:{py:0},children:(0,s.jsx)(g.Z,{primary:e,primaryTypographyProps:{variant:"body2",fontFamily:"monospace"}})},e))})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(o.Z,{onClick:a,color:"inherit",children:"Cancel"}),(0,s.jsx)(o.Z,{onClick:n,variant:"outlined",children:"Save Only"}),(0,s.jsx)(o.Z,{onClick:i,variant:"contained",color:"warning",children:"Save & Restart"})]})]})}var eI=r(1217),ez=r(84974),eF=r(23482),eP=r(61244),eW=r(87739);let eA=[{id:"gameplay",icon:eI.Z,title:"Gameplay",description:"Core game rules and player experience settings.",essentialFields:[{key:"difficulty",label:"Difficulty",type:"select",options:[{value:"peaceful",label:"Peaceful"},{value:"easy",label:"Easy"},{value:"normal",label:"Normal"},{value:"hard",label:"Hard"}]},{key:"gameMode",label:"Game Mode",type:"select",options:[{value:"survival",label:"Survival"},{value:"creative",label:"Creative"},{value:"adventure",label:"Adventure"},{value:"spectator",label:"Spectator"}]},{key:"maxPlayers",label:"Max Players",type:"number",validation:{min:1,max:1e3}},{key:"pvp",label:"Enable PvP",type:"boolean",helperText:"Allow players to damage each other"}],advancedFields:[{key:"forceGamemode",label:"Force Game Mode",type:"boolean",helperText:"Force game mode when players join"},{key:"hardcore",label:"Hardcore",type:"boolean",helperText:"One life only - world deleted on death"},{key:"allowFlight",label:"Allow Flight",type:"boolean",helperText:"Allow flight in survival mode"},{key:"allowNether",label:"Allow Nether",type:"boolean",helperText:"Enable Nether portal access"},{key:"enableCommandBlock",label:"Command Blocks",type:"boolean",helperText:"Enable command block functionality"},{key:"spawnProtection",label:"Spawn Protection",type:"number",helperText:"Radius around spawn (0 = disabled)",unit:"blocks",validation:{min:0,max:256}},{key:"spawnAnimals",label:"Spawn Animals",type:"boolean",helperText:"Spawn passive mobs (cows, pigs, etc.)"},{key:"spawnMonsters",label:"Spawn Monsters",type:"boolean",helperText:"Spawn hostile mobs (zombies, creepers, etc.)"},{key:"spawnNpcs",label:"Spawn NPCs",type:"boolean",helperText:"Spawn villagers and wandering traders"}]},{id:"world",icon:ez.Z,title:"World",description:"World generation and server identity settings.",essentialFields:[{key:"motd",label:"MOTD (Message of the Day)",type:"string",helperText:"Displayed in the server list",columns:12},{key:"level",label:"World Name",type:"string",helperText:"Save folder name",restartRequired:!0},{key:"levelType",label:"Level Type",type:"select",restartRequired:!0,options:[{value:"default",label:"Default"},{value:"flat",label:"Flat"},{value:"largeBiomes",label:"Large Biomes"},{value:"amplified",label:"Amplified"},{value:"buffet",label:"Buffet"}]},{key:"seed",label:"World Seed",type:"string",helperText:"Only affects new world generation",restartRequired:!0}],advancedFields:[{key:"generateStructures",label:"Generate Structures",type:"boolean",helperText:"Generate villages, temples, etc."},{key:"maxWorldSize",label:"Max World Size",type:"number",unit:"blocks",helperText:"Maximum world radius",validation:{min:1,max:29999984}},{key:"icon",label:"Server Icon URL",type:"string",helperText:"64x64 PNG image URL",columns:12}]},{id:"security",icon:eF.Z,title:"Security",description:"Authentication and access control settings.",essentialFields:[{key:"onlineMode",label:"Online Mode (Mojang Auth)",type:"boolean",helperText:"Disable to allow cracked clients (not recommended)",restartRequired:!0},{key:"enableWhitelist",label:"Enable Whitelist",type:"boolean",helperText:"Only whitelisted players can join",restartRequired:!0}],advancedFields:[{key:"enforceWhitelist",label:"Enforce Whitelist",type:"boolean",helperText:"Kick non-whitelisted players already online",restartRequired:!0},{key:"enforceSecureProfile",label:"Enforce Secure Profile",type:"boolean",helperText:"Require signed chat messages from players",restartRequired:!0}]},{id:"performance",icon:q.Z,title:"Performance & JVM",description:"Memory, view distance, and JVM optimization settings.",essentialFields:[{key:"memory",label:"Memory",type:"string",helperText:"e.g., 2G, 4G, 8G",restartRequired:!0},{key:"useAikarFlags",label:"Aikar's Flags",type:"boolean",helperText:"Optimized GC flags for Paper/Spigot",restartRequired:!0},{key:"viewDistance",label:"View Distance",type:"number",unit:"chunks",validation:{min:2,max:32}}],advancedFields:[{key:"simulationDistance",label:"Simulation Distance",type:"number",unit:"chunks",validation:{min:3,max:32}},{key:"maxTickTime",label:"Max Tick Time",type:"number",unit:"ms",helperText:"-1 to disable watchdog",validation:{min:-1}},{key:"initMemory",label:"Initial Heap",type:"string",helperText:"e.g., 1G (overrides Memory)",restartRequired:!0},{key:"maxMemory",label:"Max Heap",type:"string",helperText:"e.g., 8G (overrides Memory)",restartRequired:!0},{key:"jvmXxOpts",label:"JVM -XX Options",type:"string",helperText:"Additional -XX JVM flags",restartRequired:!0,columns:12}]},{id:"autopause",icon:eP.Z,title:"Auto-pause / Auto-stop",description:"Automatically pause or stop when no players are connected.",essentialFields:[{key:"enableAutopause",label:"Enable Auto-pause",type:"boolean",helperText:"Pause process when no players connected",restartRequired:!0},{key:"autopauseTimeoutEst",label:"Pause Timeout",type:"number",unit:"seconds",helperText:"Wait time after last player leaves",validation:{min:0}}],advancedFields:[{key:"autopauseTimeoutInit",label:"Init Timeout",type:"number",unit:"seconds",helperText:"Timeout after start without connections",validation:{min:0}},{key:"autopausePeriod",label:"Check Period",type:"number",unit:"seconds",helperText:"Status check interval",validation:{min:1}},{key:"enableAutostop",label:"Enable Auto-stop",type:"boolean",helperText:"Stop container when no players connected",restartRequired:!0},{key:"autostopTimeoutEst",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Wait time before stopping container",validation:{min:0}}]},{id:"system",icon:eW.Z,title:"System",description:"Timezone, resource pack, RCON, and container settings.",essentialFields:[{key:"tz",label:"Timezone",type:"string",helperText:"e.g., Asia/Seoul, UTC",restartRequired:!0},{key:"resourcePack",label:"Resource Pack URL",type:"string",helperText:"Direct download URL for resource pack",columns:12},{key:"enableRcon",label:"Enable RCON",type:"boolean",helperText:"Remote server console access",restartRequired:!0}],advancedFields:[{key:"resourcePackSha1",label:"Resource Pack SHA1",type:"string",helperText:"40-character hex checksum",columns:12},{key:"resourcePackEnforce",label:"Enforce Resource Pack",type:"boolean",helperText:"Kick players who decline"},{key:"resourcePackPrompt",label:"Resource Pack Prompt",type:"string",helperText:"Custom message for resource pack dialog",columns:12},{key:"rconPassword",label:"RCON Password",type:"password",restartRequired:!0},{key:"rconPort",label:"RCON Port",type:"number",validation:{min:1024,max:65535},restartRequired:!0},{key:"stopDuration",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Graceful shutdown wait time",restartRequired:!0,validation:{min:0}},{key:"uid",label:"User ID (UID)",type:"number",helperText:"Container process UID",restartRequired:!0,validation:{min:0}},{key:"gid",label:"Group ID (GID)",type:"number",helperText:"Container process GID",restartRequired:!0,validation:{min:0}}]}],eM=["memory","initMemory","maxMemory","useAikarFlags","jvmXxOpts","onlineMode","enableWhitelist","enforceWhitelist","enforceSecureProfile","level","seed","levelType","enableAutopause","enableAutostop","enableRcon","rconPassword","rconPort","tz","uid","gid","stopDuration"];function eD(e){let{serverName:t,isRunning:r}=e,{data:i,isLoading:a}=(0,eo.iC)(t),d=(0,eo.MH)(),u=(0,eo.gx)(),v=(0,eo._I)(),[y,j]=(0,n.useState)({}),[g,S]=(0,n.useState)({}),[k,R]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),[z,F]=(0,n.useState)(!1),[P,W]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==i?void 0:i.config)&&(j(i.config),S(i.config))},[i]);let A=(0,n.useMemo)(()=>{let e=[];for(let t of Object.keys(y))y[t]!==g[t]&&e.push(t);for(let t of Object.keys(g))y[t]===g[t]||e.includes(t)||e.push(t);return e},[y,g]),M=A.length>0,D=A.filter(e=>eM.includes(e)),E=D.length>0,q=(0,n.useCallback)((e,t)=>{j(r=>({...r,[e]:t}))},[]),N=(0,n.useCallback)(()=>{j(g)},[g]),B=(0,n.useCallback)(async e=>{try{let s=await d.mutateAsync({serverName:t,config:y});if(S(s.config),j(s.config),e&&r)try{await v.mutateAsync(t),W({open:!0,message:"Settings saved. Server is restarting...",severity:"warning"})}catch(e){W({open:!0,message:"Settings saved, but server restart failed. Please restart manually.",severity:"error"})}else W({open:!0,message:s.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:s.restartRequired?"warning":"success"})}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}finally{F(!1)}},[y,t,r,d,v]),U=(0,n.useCallback)(()=>{E&&r?F(!0):B(!1)},[E,r,B]),L=async()=>{if("RESET"!==T){W({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await u.mutateAsync(t),W({open:!0,message:"World reset successfully",severity:"success"}),R(!1),I("")}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return a?(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,s.jsx)(x.Z,{})}):(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(ep,{serverName:t}),eA.map(e=>(0,s.jsx)(eS,{section:e,values:y,onChange:q},e.id)),(0,s.jsx)(h.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(0,s.jsxs)(l.Z,{sx:{mb:3},children:[(0,s.jsx)(m.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will permanently delete the current world and generate a new one. This action cannot be undone."}),(0,s.jsx)(o.Z,{variant:"outlined",color:"error",startIcon:(0,s.jsx)(el.Z,{}),onClick:()=>R(!0),disabled:r,children:"Reset World"}),r&&(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,s.jsx)(eR,{hasChanges:M,changedCount:A.length,hasRestartChanges:E,isSaving:d.isPending,onSave:U,onDiscard:N}),(0,s.jsx)(eT,{open:z,changedFields:D,onSaveOnly:()=>B(!1),onSaveAndRestart:()=>B(!0),onCancel:()=>F(!1)}),(0,s.jsxs)(b.Z,{open:k,onClose:()=>R(!1),maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(ei.Z,{color:"error"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsxs)(m.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,s.jsx)("strong",{children:t})," and generate a new one."]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,s.jsx)(C.Z,{fullWidth:!0,label:"Type RESET to confirm",value:T,onChange:e=>I(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(o.Z,{onClick:()=>R(!1),children:"Cancel"}),(0,s.jsx)(o.Z,{variant:"contained",color:"error",onClick:L,disabled:"RESET"!==T||u.isPending,startIcon:u.isPending?(0,s.jsx)(x.Z,{size:16}):(0,s.jsx)(ea.Z,{}),children:u.isPending?"Resetting...":"Reset World"})]})]}),(0,s.jsx)(en.Z,{open:P.open,autoHideDuration:6e3,onClose:()=>W({...P,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,s.jsx)(c.Z,{onClose:()=>W({...P,open:!1}),severity:P.severity,sx:{width:"100%"},children:P.message})})]})}var eO=r(86702),eE=r(47606),eq=r(407),eN=r(56056),eB=r(11597),eU=r(59602);let eL={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function eH(e){let{permission:t,size:r="medium"}=e,n=eL[t];return(0,s.jsx)(M.Z,{label:n.label,color:n.color,variant:n.variant,size:r})}var eK=r(99046),eG=r(68038),eV=r(34080),eJ=r(39181),eQ=r(5632),e_=r(58919),eX=r(20367),e$=r(42936);function eY(e){var t,r;let{open:i,onClose:a,serverId:d}=e,[u,h]=(0,n.useState)(""),[p,v]=(0,n.useState)(null),[y,j]=(0,n.useState)("view"),{data:g,isLoading:S}=(r={enabled:i},(0,eQ.a)({queryKey:["users","search",u],queryFn:()=>(0,e$.SC)("/api/users?q=".concat(encodeURIComponent(u))),enabled:(null==r?void 0:r.enabled)!==!1&&u.length>=2,staleTime:3e4})),k=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>(0,e$.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["user-servers",r.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),R=(0,n.useMemo)(()=>{var e;return null!==(e=null==g?void 0:g.users)&&void 0!==e?e:[]},[g]),T=()=>{h(""),v(null),j("view"),k.reset(),a()};return(0,s.jsxs)(b.Z,{open:i,onClose:T,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,s.jsx)(f.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,s.jsxs)(Z.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[k.isError&&(0,s.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(t=k.error)||void 0===t?void 0:t.message)||"Failed to grant access"}),(0,s.jsx)(eK.Z,{options:R,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,t)=>e.id===t.id,value:p,onChange:(e,t)=>v(t),inputValue:u,onInputChange:(e,t)=>h(t),loading:S,filterOptions:e=>e,noOptionsText:u.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,s.jsx)(C.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,s.jsxs)(s.Fragment,{children:[S&&(0,s.jsx)(x.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,t)=>{var r,n,i;let{key:a,...o}=e;return(0,s.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,s.jsx)(eO.Z,{src:null!==(i=t.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(r=t.name)||void 0===r?void 0:r[0])||(null===(n=t.email)||void 0===n?void 0:n[0])||"?").toUpperCase()}),(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:t.name||"Unknown"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:t.email})]})]},a)}}),(0,s.jsxs)(ej.Z,{children:[(0,s.jsx)(eG.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,s.jsxs)(eV.Z,{value:y,onChange:e=>j(e.target.value),children:[(0,s.jsx)(eb.Z,{value:"view",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,s.jsx)(eb.Z,{value:"manage",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,s.jsx)(eb.Z,{value:"admin",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,s.jsxs)(w.Z,{sx:{px:3,pb:2},children:[(0,s.jsx)(o.Z,{onClick:T,color:"inherit",children:"Cancel"}),(0,s.jsx)(o.Z,{onClick:()=>{p&&k.mutate({userId:p.id,serverId:d,permission:y},{onSuccess:T})},variant:"contained",disabled:!p||k.isPending,sx:{borderRadius:2},children:k.isPending?"Adding...":"Add User"})]})]})}function e0(e){var t,r;let{serverId:i}=e,{data:a,isLoading:x,error:b}=(0,eQ.a)({queryKey:["user-servers",i],queryFn:()=>(0,e$.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),f=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{id:t,permission:r}=e;return(0,e$.SC)("/api/user-servers/".concat(encodeURIComponent(t)),{method:"PATCH",body:JSON.stringify({permission:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),Z=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>(0,e$.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[w,C]=(0,n.useState)(!1),[S,k]=(0,n.useState)(null),[R,T]=(0,n.useState)(null),z=(e,t)=>{k(e.currentTarget),T(t)},F=()=>{k(null),T(null)},P=e=>{if(!R||R.permission===e){F();return}f.mutate({id:R.id,permission:e},{onSettled:F})},W=null!==(t=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==t?t:0,A=(null==R?void 0:R.permission)==="admin"&&W<=1;if(x)return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%",height:32}),(0,s.jsx)(u.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,s.jsx)(O.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,s.jsx)(u.Z,{variant:"circular",width:40,height:40}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%"}),(0,s.jsx)(u.Z,{variant:"text",width:"60%"})]}),(0,s.jsx)(u.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,s.jsx)(u.Z,{variant:"circular",width:32,height:32})]},e))]})});if(b)return(0,s.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",b.message]});let M=null!==(r=null==a?void 0:a.users)&&void 0!==r?r:[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(eE.Z,{}),onClick:()=>C(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,s.jsx)(O.Z,{sx:{mb:1}}),0===M.length?(0,s.jsx)(l.Z,{sx:{py:4,textAlign:"center"},children:(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):M.map(e=>{var t,r,n,i,a,o,c,x;return(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,s.jsx)(eO.Z,{src:null!==(x=null===(t=e.user)||void 0===t?void 0:t.image)&&void 0!==x?x:void 0,sx:{width:40,height:40,bgcolor:"primary.main",fontSize:16},children:((null===(n=e.user)||void 0===n?void 0:null===(r=n.name)||void 0===r?void 0:r[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,s.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.name)||"Unknown User"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(c=e.user)||void 0===c?void 0:c.email)||e.userId})]}),(0,s.jsx)(eH,{permission:e.permission,size:"small"}),(0,s.jsx)(d.Z,{size:"small",onClick:t=>z(t,e),sx:{color:"text.secondary"},children:(0,s.jsx)(I.Z,{fontSize:"small"})})]},e.id)}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,s.jsx)(eU.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,s.jsxs)(v.Z,{anchorEl:S,open:!!S,onClose:F,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,s.jsxs)(y.Z,{onClick:()=>P("admin"),disabled:(null==R?void 0:R.permission)==="admin",children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eq.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Owner"})]}),(0,s.jsxs)(y.Z,{onClick:()=>P("manage"),disabled:(null==R?void 0:R.permission)==="manage"||A,children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eN.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Operator"})]}),(0,s.jsxs)(y.Z,{onClick:()=>P("view"),disabled:(null==R?void 0:R.permission)==="view"||A,children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eZ.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Viewer"})]}),(0,s.jsx)(O.Z,{}),(0,s.jsxs)(y.Z,{onClick:()=>{R&&Z.mutate(R.id,{onSettled:F})},disabled:A,sx:{color:"error.main"},children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eB.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,s.jsx)(g.Z,{children:"Remove Access"})]})]}),(0,s.jsx)(eY,{open:w,onClose:()=>C(!1),serverId:i})]})}var e1=r(10449),e2=r(24559),e3=r(37228);function e6(e){let{text:t}=e,[r,i]=(0,n.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){console.error("Failed to copy:",e)}};return(0,s.jsx)(d.Z,{size:"small",onClick:a,sx:{ml:1,color:r?"success.main":"text.secondary","&:hover":{bgcolor:"action.hover"}},"aria-label":r?"Copied":"Copy to clipboard",children:r?(0,s.jsx)(e2.Z,{sx:{fontSize:16}}):(0,s.jsx)(e1.Z,{sx:{fontSize:16}})})}function e5(e){let{label:t,value:r,copyText:n}=e;return(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1},children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,s.jsx)(m.Z,{variant:"body2",sx:{fontFamily:n?"monospace":"inherit",color:n?"text.primary":"text.secondary"},children:r}),n&&(0,s.jsx)(e6,{text:n})]})]})}function e4(e){let{serverName:t,hostname:r}=e,{data:n,isLoading:i}=(0,e3.UW)();if(i)return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]})]})});let a=r?"".concat(r,":25565"):"Not configured",o=(null==n?void 0:n.enabled)&&n.servers.length>0,d=null==n?void 0:n.servers.find(e=>e.serverName===t),c=(null==d?void 0:d.playitDomain)||"Not configured",x=!!(null==d?void 0:d.playitDomain);return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Connection"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(e5,{label:"LAN Address",value:a,copyText:r?a:void 0}),o&&(0,s.jsx)(e5,{label:"External Address",value:c,copyText:x?c:void 0})]})})}var e8=r(42431),e7=r(76777),e9=r(15761);function te(e){let{serverName:t}=e,{data:r,isLoading:i,error:a}=(0,eQ.a)({queryKey:["servers",t,"mods"],queryFn:()=>(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods")),enabled:!!t}),u=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{serverName:t,slugs:r,source:s}=e;return(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods"),{method:"POST",body:JSON.stringify({slugs:r,source:s})})},onSuccess:(t,r)=>{let{serverName:s}=r;e.invalidateQueries({queryKey:["servers",s,"mods"]})}})}(),v=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{serverName:t,slug:r}=e;return(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods/").concat(encodeURIComponent(r)),{method:"DELETE"})},onSuccess:(t,r)=>{let{serverName:s}=r;e.invalidateQueries({queryKey:["servers",s,"mods"]})}})}(),[y,j]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,k]=(0,n.useState)(""),[R,T]=(0,n.useState)(!1),[I,F]=(0,n.useState)({open:!1,message:"",severity:"info"}),{data:P,isLoading:W}=function(e,t){let r=new URLSearchParams;return e&&r.set("q",e),(null==t?void 0:t.limit)!=null&&r.set("limit",String(t.limit)),(null==t?void 0:t.offset)!=null&&r.set("offset",String(t.offset)),(0,eQ.a)({queryKey:["mods","search",e,null==t?void 0:t.limit,null==t?void 0:t.offset],queryFn:()=>(0,e$.SC)("/api/mods/search?".concat(r)),enabled:(null==t?void 0:t.enabled)!==!1&&!!e.trim()})}(S,{limit:10,enabled:y&&S.length>0});(0,n.useEffect)(()=>{let e=setTimeout(()=>{k(g)},300);return()=>clearTimeout(e)},[g]);let A=(0,n.useCallback)(async e=>{try{await v.mutateAsync({serverName:t,slug:e}),T(!0),F({open:!0,message:"Removed ".concat(e),severity:"success"})}catch(e){F({open:!0,message:e instanceof Error?e.message:"Failed to remove mod",severity:"error"})}},[v,t]),q=(0,n.useCallback)(async e=>{try{await u.mutateAsync({serverName:t,slugs:[e]}),T(!0),F({open:!0,message:"Added ".concat(e),severity:"success"})}catch(e){F({open:!0,message:e instanceof Error?e.message:"Failed to add mod",severity:"error"})}},[u,t]),N=new Set;if(null==r?void 0:r.mods)for(let e of Object.values(r.mods))for(let t of e)N.add(t);if(i)return(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,s.jsx)(x.Z,{})});if(a)return(0,s.jsxs)(c.Z,{severity:"error",sx:{mt:2},children:["Failed to load mods: ",a.message]});let B=N.size>0;return(0,s.jsxs)(l.Z,{children:[R&&(0,s.jsx)(c.Z,{severity:"info",sx:{mb:2},children:"Restart the server to apply mod changes."}),(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Installed Mods"}),(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(ex.Z,{}),onClick:()=>{w(""),k(""),j(!0)},children:"Add Mods"})]}),(0,s.jsx)(O.Z,{sx:{mb:2}}),B?Object.entries(r.mods).map(e=>{let[t,r]=e;return(0,s.jsxs)(l.Z,{sx:{mb:2},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1,textTransform:"capitalize"},children:t}),(0,s.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:r.map(e=>(0,s.jsx)(M.Z,{label:e,icon:(0,s.jsx)(e7.Z,{}),onDelete:()=>A(e),deleteIcon:(0,s.jsx)(z.Z,{}),variant:"outlined"},e))})]},t)}):(0,s.jsxs)(l.Z,{sx:{textAlign:"center",py:4},children:[(0,s.jsx)(e7.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"No mods installed"}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mt:.5},children:'Click "Add Mods" to search and install mods from Modrinth'})]})]})}),(0,s.jsxs)(b.Z,{open:y,onClose:()=>j(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{minHeight:400}},children:[(0,s.jsxs)(f.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Search Mods",(0,s.jsx)(d.Z,{onClick:()=>j(!1),size:"small",children:(0,s.jsx)(E.Z,{})})]}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(C.Z,{fullWidth:!0,autoFocus:!0,placeholder:"Search Modrinth...",value:g,onChange:e=>w(e.target.value),InputProps:{startAdornment:(0,s.jsx)(D.Z,{position:"start",children:(0,s.jsx)(e8.Z,{})})},sx:{mb:2}}),W&&(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(x.Z,{size:28})}),!W&&P&&0===P.hits.length&&S&&(0,s.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:4},children:['No mods found for "',S,'"']}),!W&&P&&P.hits.length>0&&(0,s.jsx)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:P.hits.map(e=>{var t;let r=N.has(e.slug);return(0,s.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,s.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,s.jsx)(eO.Z,{src:e.iconUrl||void 0,variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,s.jsx)(e7.Z,{})}),(0,s.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",noWrap:!0,children:e.title}),(0,s.jsx)(o.Z,{size:"small",variant:r?"outlined":"contained",disabled:r||u.isPending,onClick:()=>q(e.slug),sx:{ml:1,minWidth:80,flexShrink:0},children:r?"Installed":"Add"})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:.25,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.description}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.25},children:[(0,s.jsx)(e9.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:(t=e.downloads)>=1e6?"".concat((t/1e6).toFixed(1),"M"):t>=1e3?"".concat((t/1e3).toFixed(1),"K"):String(t)})]}),e.author&&(0,s.jsxs)(m.Z,{variant:"caption",color:"text.disabled",children:["by ",e.author]})]})]})]})})},e.slug)})})]})]}),(0,s.jsx)(en.Z,{open:I.open,autoHideDuration:4e3,onClose:()=>F(e=>({...e,open:!1})),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,s.jsx)(c.Z,{onClose:()=>F(e=>({...e,open:!1})),severity:I.severity,variant:"filled",children:I.message})})]})}let tt=["Overview","Activity","Mods","Files","Backups","Access","Options"];function tr(e){return e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[a-zA-Z]/g,"").replace(/\[m/g,"").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"").trim()}function ts(e){var t,r,i,a,c;let{server:x,onSendCommand:u}=e,[v,y]=(0,n.useState)("Overview"),[j,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(!0),[R,T]=(0,n.useState)(!1),I=(0,n.useRef)(null),{logs:z,isConnected:F}=(0,V.Y)({serverName:x.name}),P=(0,n.useMemo)(()=>z.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[z]);(0,n.useEffect)(()=>{I.current&&f&&(I.current.scrollTop=I.current.scrollHeight)},[P,f]);let W=async()=>{j.trim()&&u&&(await u(j.trim()),g(""))},A=null!==(a=null===(t=x.stats)||void 0===t?void 0:t.cpuPercent)&&void 0!==a?a:0;(null===(r=x.stats)||void 0===r?void 0:r.memoryUsage)&&x.stats.memoryUsage,function(e){if(!e)return;let t=e.match(/^(\d+)\s*(M|G)?$/i);if(t)parseInt(t[1],10),(t[2]||"M").toUpperCase()}(x.memory);let K=null!==(c=null===(i=x.stats)||void 0===i?void 0:i.memoryPercent)&&void 0!==c?c:0;return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:tt.map(e=>(0,s.jsx)(o.Z,{onClick:()=>y(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:v===e?"primary.main":"transparent",color:v===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:v===e?"primary.main":(0,k.Fq)("#1bd96a",.1)}},children:e},e))}),(0,s.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,s.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,s.jsx)(q.Z,{sx:{fontSize:28}}),progress:A,progressMax:100,color:"#1bd96a"}),(0,s.jsx)(G,{value:"".concat(K.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,s.jsx)(N.Z,{sx:{fontSize:28}}),progress:K,progressMax:100,color:"#1bd96a"}),(0,s.jsx)(G,{value:x.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,s.jsx)(B.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let t=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!t)return 0;let r=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*r;case"MB":case"MIB":return r;case"KB":return r/1024;default:return r/1048576}}(x.worldSize),progressMax:10240,color:"#1bd96a"})]}),(0,s.jsxs)(h.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,s.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,s.jsx)(m.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,s.jsx)(l.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:F?"primary.main":"error.main",boxShadow:F?"0 0 8px rgba(27, 217, 106, 0.4)":"0 0 8px rgba(239, 68, 68, 0.4)"}})]}),(0,s.jsxs)(l.Z,{sx:{position:"relative"},children:[(0,s.jsx)(l.Z,{ref:I,onScroll:()=>{if(!I.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:r}=I.current;w(t-e-r<30)},sx:{height:360,overflowY:"auto",px:2.5,py:2,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace",fontSize:13,lineHeight:1.85,color:"#b4b6c4",bgcolor:"#0a0a0a",scrollbarWidth:"thin",scrollbarColor:"#3a3d4e #0a0a0a","&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"#0a0a0a"},"&::-webkit-scrollbar-thumb":{bgcolor:"#3a3d4e",borderRadius:4}},children:0===P.length?(0,s.jsx)(m.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):P.map((e,t)=>{let r=function(e){let t=tr(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return t?{time:t[1],thread:t[2],level:t[3]||"INFO",msg:t[4]}:null}(e);return r?(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,s.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",r.time,"]"]}),(0,s.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",r.thread,"/",(0,s.jsx)(l.Z,{component:"span",sx:{color:"WARN"===r.level?"#e8a848":"#6b6e80"},children:r.level}),"]:\xa0"]}),(0,s.jsx)(l.Z,{component:"span",sx:{color:"WARN"===r.level?"#c4a45a":"#b4b6c4"},children:r.msg})]},t):(0,s.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:tr(e)},t)})}),(0,s.jsx)(d.Z,{onClick:()=>T(!0),sx:{position:"absolute",top:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,s.jsx)(U.Z,{sx:{fontSize:18}})}),!f&&(0,s.jsx)(d.Z,{onClick:()=>{I.current&&I.current.scrollTo({top:I.current.scrollHeight,behavior:"smooth"})},sx:{position:"absolute",bottom:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,s.jsx)(L.Z,{sx:{fontSize:18}})})]}),(0,s.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:j,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),W())},disabled:!F,InputProps:{startAdornment:(0,s.jsx)(D.Z,{position:"start",children:(0,s.jsx)(H.Z,{sx:{fontSize:16,color:"#999"}})}),sx:{bgcolor:"#13141c",borderRadius:2,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",fontSize:14,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#2a2d3e"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#3a3d4e"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}})})]}),"Overview"===v&&(0,s.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(tn,{label:"Name",value:x.name}),(0,s.jsx)(tn,{label:"Container",value:x.container}),(0,s.jsx)(tn,{label:"Hostname",value:x.hostname}),(0,s.jsx)(tn,{label:"Type",value:x.type}),(0,s.jsx)(tn,{label:"Version",value:x.version}),(0,s.jsx)(tn,{label:"Memory",value:x.memory}),(0,s.jsx)(tn,{label:"Uptime",value:x.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60;return t>0?"".concat(t,"h ").concat(r,"m"):r>0?"".concat(r,"m ").concat(s,"s"):"".concat(s,"s")}(x.uptimeSeconds)})]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),x.players?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tn,{label:"Online",value:"".concat(x.players.online," / ").concat(x.players.max)}),x.players.players&&x.players.players.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,s.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.players.map(e=>(0,s.jsx)(M.Z,{label:e,size:"small"},e))})]})]}):(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(e4,{serverName:x.name,hostname:x.hostname})})]}),"Activity"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(es,{serverName:x.name})]})})}),"Mods"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(te,{serverName:x.name})}),"Files"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(e0,{serverId:x.name})}),"Options"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(eD,{serverName:x.name,isRunning:"running"===x.status})}),(0,s.jsxs)(b.Z,{open:R,onClose:()=>T(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,s.jsxs)(m.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",x.name]}),(0,s.jsx)(d.Z,{onClick:()=>T(!1),children:(0,s.jsx)(E.Z,{})})]}),(0,s.jsx)(Z.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,s.jsx)(J.K,{serverName:x.name})})]})]})}function tn(e){let{label:t,value:r}=e;return r?(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,s.jsx)(m.Z,{variant:"body2",sx:{fontWeight:500},children:r})]}):null}var ti=r(93757);function ta(){return(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function tl(){return(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M21 2v6h-6"}),(0,s.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,s.jsx)("path",{d:"M3 22v-6h6"}),(0,s.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function to(){var e,t,r,M;let D=(0,i.useParams)(),O=(0,a.x)(),E=decodeURIComponent(D.name),{data:q,isLoading:N,error:B}=(0,eo.Hy)(E),{status:U,health:L}=function(e){let{serverName:t,onStatusChange:r,enabled:s=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,n.useState)(null),[o,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{l(null),d(null)},[t]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let t=e.data.status,s=e.data.health;l(t),d(s),null==r||r(t,s)}},[r]),{isConnected:x,reconnect:u,retryCount:h}=(0,ti.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/status"),onMessage:c,enabled:s,reconnectInterval:i});return{status:a,health:o,isConnected:x,reconnect:u,retryCount:h}}({serverName:E,enabled:!!E}),[H,K]=(0,n.useState)(null),[G,V]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(""),_=(0,eo.jM)(),X=(0,eo.Aw)(),$=(0,eo._I)(),Y=(0,eo.Hq)(),ee=async()=>{try{await _.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},et=async()=>{try{await X.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},er=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},es=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(E),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=U||(null==q?void 0:q.server.status),ei=_.isPending||X.isPending||$.isPending,ea=null==q?void 0:q.server;return(0,s.jsxs)(s.Fragment,{children:[B&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",B.message]}),_.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=_.error)||void 0===e?void 0:e.message]}),X.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=X.error)||void 0===t?void 0:t.message]}),$.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(r=$.error)||void 0===r?void 0:r.message]}),Y.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(M=Y.error)||void 0===M?void 0:M.message]}),N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:40}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,s.jsx)(u.Z,{variant:"text",width:100}),(0,s.jsx)(u.Z,{variant:"text",width:60}),(0,s.jsx)(u.Z,{variant:"text",width:140}),(0,s.jsx)(u.Z,{variant:"text",width:50})]})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,s.jsx)(u.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,s.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,t)=>(0,s.jsx)(u.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},t))}),(0,s.jsx)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[0,1,2].map(e=>(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,s.jsx)(u.Z,{variant:"text",width:"50%"}),(0,s.jsx)(u.Z,{variant:"circular",width:28,height:28})]}),(0,s.jsx)(u.Z,{variant:"text",width:"60%",height:36}),(0,s.jsx)(u.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,s.jsxs)(h.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,s.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,s.jsx)(u.Z,{variant:"text",width:80,height:28}),(0,s.jsx)(u.Z,{variant:"circular",width:10,height:10})]}),(0,s.jsx)(u.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,s.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,s.jsx)(u.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,s.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"25%"}),(0,s.jsx)(u.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,s.jsx)(l.Z,{sx:{width:64,height:64,borderRadius:3,overflow:"hidden",bgcolor:"background.paper",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"1px solid",borderColor:"divider",fontSize:36},children:function(e){if(!e)return"\uD83C\uDFAE";let t=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(t)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(t)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsxs)(m.Z,{onClick:()=>O.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,s.jsx)(R.Z,{sx:{fontSize:14}})," All servers"]}),(0,s.jsx)(m.Z,{variant:"h4",component:"h1",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"text.primary",letterSpacing:"0.5px",m:0,textTransform:"uppercase"},children:E}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(F.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(P.Z,{sx:{fontSize:14}}),ea.type]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(W.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(A.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60;return t>0?"".concat(t,"h ").concat(r,"m"):r>0?"".concat(r,"m ").concat(s,"s"):"".concat(s,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,s.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(T.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===en&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{variant:"outlined",startIcon:ei?(0,s.jsx)(x.Z,{size:16}):(0,s.jsx)(ta,{}),onClick:et,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,k.Fq)("#fff",.05)}},children:"Stop"}),(0,s.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(tl,{}),onClick:er,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600,bgcolor:"primary.main",color:"#0a0e14","&:hover":{bgcolor:"primary.dark"}},children:"Restart"})]}),(0,s.jsx)(d.Z,{onClick:e=>K(e.currentTarget),sx:{width:36,height:36,borderRadius:2,border:"1px solid",borderColor:"divider",color:"text.secondary"},children:(0,s.jsx)(I.Z,{sx:{fontSize:18}})}),(0,s.jsx)(v.Z,{anchorEl:H,open:!!H,onClose:()=>K(null),children:(0,s.jsxs)(y.Z,{onClick:()=>{K(null),V(!0),Q("")},sx:{color:"error.main"},children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(z.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,s.jsx)(g.Z,{children:"Delete Server"})]})})]})]}),(0,s.jsx)(ts,{server:ea,onSendCommand:es})]}):(0,s.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,s.jsxs)(b.Z,{open:G,onClose:()=>{V(!1),Q("")},maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:"Delete Server"}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsxs)(m.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,s.jsx)("strong",{children:E})," to confirm deletion."]}),(0,s.jsx)(C.Z,{label:"Server name",value:J,onChange:e=>Q(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,s.jsxs)(w.Z,{sx:{px:3,pb:2},children:[(0,s.jsx)(o.Z,{onClick:()=>{V(!1),Q("")},children:"Cancel"}),(0,s.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{J===E&&Y.mutate({name:E,force:!0},{onSuccess:()=>{O.push("/servers")}})},disabled:J!==E||Y.isPending,startIcon:Y.isPending?(0,s.jsx)(x.Z,{size:16}):null,children:Y.isPending?"Deleting...":"Delete"})]})]})]})}},56813:function(e,t,r){"use strict";r.d(t,{I:function(){return a}});var s=r(94655),n=r(25333),i=r(82925);function a(e){let{action:t,size:r="small"}=e,a=i.Lu[t]||"default",l=i.n3[t]||t;return(0,s.jsx)(n.Z,{label:l,color:a,size:r,variant:"filled",sx:{fontWeight:600,fontSize:"small"===r?"0.7rem":"0.8rem"}})}},26892:function(e,t,r){"use strict";r.d(t,{c:function(){return l}});var s=r(94655),n=r(25333),i=r(46207),a=r(43436);function l(e){let{status:t,size:r="small"}=e;return(0,s.jsx)(n.Z,{icon:"success"===t?(0,s.jsx)(i.Z,{}):(0,s.jsx)(a.Z,{}),label:"success"===t?"OK":"Error",color:"success"===t?"success":"error",size:r,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===r?"0.7rem":"0.8rem"}})}},84509:function(e,t,r){"use strict";r.d(t,{DM:function(){return a},HZ:function(){return o},VM:function(){return l},hT:function(){return i},oL:function(){return d}});var s=r(5632),n=r(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=function(e){let t=new URLSearchParams;e.action&&t.set("action",e.action),e.actor&&t.set("actor",e.actor),e.targetType&&t.set("targetType",e.targetType),e.targetName&&t.set("targetName",e.targetName),e.status&&t.set("status",e.status),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.offset&&t.set("offset",String(e.offset)),e.sort&&t.set("sort",e.sort);let r=t.toString();return r?"?".concat(r):""}(e);return(0,s.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs".concat(r)),enabled:(null==t?void 0:t.enabled)!==!1})}function a(e){return(0,s.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,n.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function l(e,t){return(0,s.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function o(e,t){var r;return i({targetType:"server",targetName:e,limit:null!==(r=null==t?void 0:t.limit)&&void 0!==r?r:20},{enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},37228:function(e,t,r){"use strict";r.d(t,{Bc:function(){return o},N$:function(){return d},UW:function(){return l}});var s=r(5632),n=r(58919),i=r(20367),a=r(42936);function l(){return(0,s.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function o(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function d(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},82925:function(e,t,r){"use strict";r.d(t,{KK:function(){return l},Lu:function(){return s},Xn:function(){return a},n3:function(){return n},xg:function(){return i}});let s={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},n={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],l=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,55,7727,8347,1658,3945,6727,6645,2535,4219,4436,2666,5787,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,t,r){Promise.resolve().then(r.bind(r,46812))},46812:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return to}});var s=r(94655),n=r(35106),i=r(74228),a=r(31358),l=r(7281),o=r(30417),d=r(79983),c=r(81071),x=r(93017),u=r(10721),h=r(628),p=r(41565),m=r(31317),v=r(35694),y=r(7178),j=r(17820),g=r(73424),b=r(99770),f=r(62508),Z=r(5682),w=r(76678),C=r(97436),S=r(84840),k=r(76492),R=r(10117),T=r(5501),I=r(37809),z=r(21111),F=r(17978),P=r(89573),W=r(96292),A=r(33104),M=r(25333),D=r(52082),O=r(69123),E=r(71185),q=r(30165),N=r(97293),B=r(11259),U=r(66615),L=r(89161),H=r(34071),K=r(4405);function G(e){let{value:t,unit:r,label:n,icon:i,progress:a,progressMax:o,color:d="#1bd96a"}=e;return(0,s.jsxs)(h.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,s.jsx)(m.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",fontFamily:"'JetBrains Mono', 'Fira Code', monospace",letterSpacing:"-0.5px"},children:t}),(0,s.jsx)(m.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:r})]}),(0,s.jsx)(l.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,s.jsx)(m.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:n}),(0,s.jsx)(K.Z,{variant:"determinate",value:Math.min(a/o*100,100),sx:{mt:1,height:6,borderRadius:1.5,bgcolor:"#2a2d3a","& .MuiLinearProgress-bar":{borderRadius:1.5,background:"linear-gradient(90deg, ".concat(d," 0%, ").concat(d,"cc 100%)")}}})]})}var V=r(163),J=r(73660),Q=r(90158),_=r(58347),X=r(95511),$=r(46725),Y=r(26577),ee=r(56813),et=r(26892),er=r(84509);function es(e){var t;let{serverName:r}=e,{data:n,isLoading:i,error:a}=(0,er.HZ)(r,{limit:20});if(i)return(0,s.jsx)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:60,height:24}),(0,s.jsx)(u.Z,{variant:"text",width:"60%"}),(0,s.jsx)(u.Z,{variant:"text",width:50})]},t))});if(a)return(0,s.jsxs)(c.Z,{severity:"error",children:["Failed to load activity: ",a.message]});let d=null!==(t=null==n?void 0:n.logs)&&void 0!==t?t:[];if(0===d.length)return(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"No activity recorded for this server yet."});let x="/audit-logs?targetType=server&targetName=".concat(encodeURIComponent(r));return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(Q.Z,{sx:{py:0},children:d.map(e=>{var t;return(0,s.jsx)(_.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,s.jsx)(g.Z,{primary:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(ee.I,{action:e.action,size:"small"}),(0,s.jsxs)(m.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),(0,s.jsx)(et.c,{status:e.status,size:"small"})]}),secondary:(0,s.jsx)(X.Z,{title:(t=e.timestamp,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}).format(new Date(t))),arrow:!0,children:(0,s.jsx)(m.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let t=new Date,r=new Date(e),s=Math.floor((t.getTime()-r.getTime())/6e4),n=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(e.timestamp)})})})},e.id)})}),(0,s.jsx)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,s.jsx)(o.Z,{component:$.default,href:x,size:"small",endIcon:(0,s.jsx)(Y.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var en=r(37530),ei=r(84420),ea=r(46121),el=r(84775),eo=r(92666),ed=r(70115),ec=r(70603),ex=r(32366),eu=r(5942),eh=r(25523);function ep(e){let{serverName:t}=e,{data:r,isLoading:i}=(0,eo.Js)(t),a=(0,eo.Bx)(),[u,v]=(0,n.useState)([]),[y,j]=(0,n.useState)(!1),[g,b]=(0,n.useState)(!1),[f,Z]=(0,n.useState)(""),[w,S]=(0,n.useState)(""),[k,R]=(0,n.useState)(!1),[T,I]=(0,n.useState)({open:!1,message:"",severity:"success"});(0,n.useEffect)(()=>{(null==r?void 0:r.customHostnames)&&(v(r.customHostnames),j(!1),R(!1))},[r]);let F=e=>{let t=e.trim().toLowerCase();return t?t.length>253?"Domain exceeds 253 characters":/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/.test(t)?t.endsWith(".local")?"Cannot use .local system domain":t.endsWith(".nip.io")?"Cannot use .nip.io system domain":u.includes(t)?"Domain already exists":"":"Invalid domain format":"Domain cannot be empty"},P=()=>{let e=f.trim().toLowerCase(),t=F(e);if(t){S(t);return}v(t=>[...t,e]),Z(""),S(""),b(!1),j(!0)},W=e=>{v(t=>t.filter(t=>t!==e)),j(!0)},A=async()=>{try{await a.mutateAsync({serverName:t,customHostnames:u}),j(!1),R(!0),I({open:!0,message:"Hostnames saved. Container recreation required to apply changes.",severity:"warning"})}catch(e){I({open:!0,message:e instanceof Error?e.message:"Failed to save hostnames",severity:"error"})}},D=()=>{b(!1),Z(""),S("")};return i?(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsx)(p.Z,{children:(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(x.Z,{size:24})})})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,s.jsx)(eh.Z,{color:"primary"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Hostnames / Domains"})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Manage hostnames used by mc-router to route connections to this server."}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(null==r?void 0:r.systemHostnames)&&r.systemHostnames.length>0&&(0,s.jsxs)(l.Z,{sx:{mb:3},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"System Hostnames (read-only)"}),(0,s.jsx)(ed.Z,{direction:"row",flexWrap:"wrap",gap:1,children:r.systemHostnames.map(e=>(0,s.jsx)(M.Z,{icon:(0,s.jsx)(ec.Z,{sx:{fontSize:16}}),label:e.hostname,title:e.description,variant:"outlined",color:"default",size:"small"},e.hostname))})]}),(0,s.jsxs)(l.Z,{sx:{mb:2},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"Custom Domains"}),0===u.length&&!g&&(0,s.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mb:1},children:"No custom domains configured."}),(0,s.jsx)(ed.Z,{spacing:1,children:u.map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5,px:1.5,borderRadius:1,bgcolor:"action.hover"},children:[(0,s.jsx)(m.Z,{variant:"body2",fontFamily:"monospace",children:e}),(0,s.jsx)(d.Z,{size:"small",color:"error",onClick:()=>W(e),title:"Remove domain",children:(0,s.jsx)(z.Z,{fontSize:"small"})})]},e))}),g?(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"flex-start",gap:1,mt:1},children:[(0,s.jsx)(C.Z,{size:"small",placeholder:"e.g. play.example.com",value:f,onChange:e=>{Z(e.target.value),S("")},onKeyDown:e=>{"Enter"===e.key&&P(),"Escape"===e.key&&D()},error:!!w,helperText:w,autoFocus:!0,sx:{flex:1}}),(0,s.jsx)(o.Z,{size:"small",variant:"contained",onClick:P,children:"Add"}),(0,s.jsx)(d.Z,{size:"small",onClick:D,children:(0,s.jsx)(E.Z,{fontSize:"small"})})]}):(0,s.jsx)(o.Z,{size:"small",startIcon:(0,s.jsx)(ex.Z,{}),onClick:()=>b(!0),sx:{mt:1},children:"Add Domain"})]}),k&&(0,s.jsxs)(c.Z,{severity:"warning",sx:{mb:2},children:["Container recreation is required for hostname changes to take effect. Run ",(0,s.jsx)("code",{children:"docker compose up -d"})," or restart the server from the dashboard."]}),(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(eu.Z,{}),onClick:A,disabled:!y||a.isPending,children:a.isPending?"Saving...":"Save Hostnames"})})]})}),(0,s.jsx)(en.Z,{open:T.open,autoHideDuration:6e3,onClose:()=>I({...T,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,s.jsx)(c.Z,{onClose:()=>I({...T,open:!1}),severity:T.severity,sx:{width:"100%"},children:T.message})})]})}var em=r(87716),ev=r(81960),ey=r(62328),ej=r(29793),eg=r(75726),eb=r(40064),ef=r(38393),eZ=r(28058),ew=r(42730);function eC(e){var t;let{field:r,value:i,onChange:a}=e,[o,c]=(0,n.useState)(!1),x=null!==(t=r.columns)&&void 0!==t?t:6,u=r.restartRequired?(0,s.jsx)(M.Z,{icon:(0,s.jsx)(el.Z,{sx:{fontSize:14}}),label:"Restart",size:"small",sx:{ml:1,height:20,fontSize:11,color:"warning.main",borderColor:"warning.main","& .MuiChip-icon":{color:"warning.main"}},variant:"outlined"}):null;return(0,s.jsx)(S.ZP,{item:!0,xs:12,sm:x,children:(()=>{var e,t,n,x,h,p;switch(r.type){case"boolean":return(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,s.jsx)(eb.Z,{control:(0,s.jsx)(ef.Z,{checked:null!=i&&i,onChange:e=>a(r.key,e.target.checked)}),label:r.label}),u]}),r.helperText&&(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:4,display:"block"},children:r.helperText})]});case"select":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsxs)(ej.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(eg.Z,{children:r.label}),(0,s.jsx)(ey.Z,{value:null!==(x=null!=i?i:null===(t=r.options)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.value)&&void 0!==x?x:"",label:r.label,onChange:e=>a(r.key,e.target.value),children:null===(n=r.options)||void 0===n?void 0:n.map(e=>(0,s.jsx)(y.Z,{value:e.value,children:e.label},e.value))})]})]});case"number":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",type:"number",label:r.label,value:null!=i?i:"",onChange:e=>{let t=e.target.value;a(r.key,""===t?void 0:parseInt(t,10))},inputProps:{min:null===(h=r.validation)||void 0===h?void 0:h.min,max:null===(p=r.validation)||void 0===p?void 0:p.max},helperText:r.helperText,InputProps:r.unit?{endAdornment:(0,s.jsx)(D.Z,{position:"end",children:(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:r.unit})})}:void 0})]});case"password":return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",type:o?"text":"password",label:r.label,value:null!=i?i:"",onChange:e=>a(r.key,e.target.value),helperText:r.helperText,InputProps:{endAdornment:(0,s.jsx)(D.Z,{position:"end",children:(0,s.jsx)(d.Z,{size:"small",onClick:()=>c(!o),edge:"end",children:o?(0,s.jsx)(ew.Z,{fontSize:"small"}):(0,s.jsx)(eZ.Z,{fontSize:"small"})})})}})]});default:return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mb:.5},children:u}),(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",label:r.label,value:null!=i?i:"",onChange:e=>a(r.key,e.target.value),helperText:r.helperText})]})}})()})}function eS(e){let{section:t,values:r,onChange:i}=e,[a,d]=(0,n.useState)(!1),c=t.icon,x=t.advancedFields.length;return(0,s.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,s.jsxs)(p.Z,{sx:{p:3},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1},children:[(0,s.jsx)(c,{sx:{fontSize:22,color:"primary.main"}}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:t.title})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t.description}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(0,s.jsx)(S.ZP,{container:!0,spacing:2.5,children:t.essentialFields.map(e=>(0,s.jsx)(eC,{field:e,value:r[e.key],onChange:i},e.key))}),x>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.Z,{fullWidth:!0,variant:"text",onClick:()=>d(!a),endIcon:(0,s.jsx)(ev.Z,{sx:{transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s"}}),sx:{mt:2.5,justifyContent:"flex-start",color:"text.secondary",textTransform:"none",py:1,"&:hover":{bgcolor:"action.hover"}},children:[a?"Hide":"Show"," Advanced Settings (",x,")"]}),(0,s.jsx)(em.Z,{in:a,timeout:300,children:(0,s.jsx)(l.Z,{sx:{pt:2,borderTop:"1px dashed",borderColor:"divider"},children:(0,s.jsx)(S.ZP,{container:!0,spacing:2.5,children:t.advancedFields.map(e=>(0,s.jsx)(eC,{field:e,value:r[e.key],onChange:i},e.key))})})})]})]})})}var ek=r(12550);function eR(e){let{hasChanges:t,changedCount:r,hasRestartChanges:n,isSaving:i,onSave:a,onDiscard:d}=e;return(0,s.jsx)(ek.Z,{direction:"up",in:t,mountOnEnter:!0,unmountOnExit:!0,children:(0,s.jsxs)(l.Z,{sx:{position:"sticky",bottom:0,zIndex:1100,bgcolor:"background.paper",borderTop:2,borderColor:"primary.main",px:3,py:2,mx:-3,mb:-3,boxShadow:"0 -4px 20px rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[n&&(0,s.jsx)(el.Z,{sx:{color:"warning.main",fontSize:20}}),(0,s.jsxs)(m.Z,{variant:"body2",fontWeight:600,children:[r," unsaved change",1!==r?"s":""]}),n&&(0,s.jsx)(m.Z,{variant:"caption",color:"warning.main",children:"(some require restart)"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1},children:[(0,s.jsx)(o.Z,{variant:"text",color:"inherit",onClick:d,disabled:i,children:"Discard"}),(0,s.jsx)(o.Z,{variant:"contained",startIcon:i?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(eu.Z,{}),onClick:a,disabled:i,children:i?"Saving...":"Save Changes (".concat(r,")")})]})]})})}function eT(e){let{open:t,changedFields:r,onSaveOnly:n,onSaveAndRestart:i,onCancel:a}=e;return(0,s.jsxs)(b.Z,{open:t,onClose:a,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(el.Z,{color:"warning"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Restart Required"})]})}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(m.Z,{variant:"body1",gutterBottom:!0,children:"The following changes require a server restart to take effect:"}),(0,s.jsx)(Q.Z,{dense:!0,children:r.map(e=>(0,s.jsx)(_.ZP,{sx:{py:0},children:(0,s.jsx)(g.Z,{primary:e,primaryTypographyProps:{variant:"body2",fontFamily:"monospace"}})},e))})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(o.Z,{onClick:a,color:"inherit",children:"Cancel"}),(0,s.jsx)(o.Z,{onClick:n,variant:"outlined",children:"Save Only"}),(0,s.jsx)(o.Z,{onClick:i,variant:"contained",color:"warning",children:"Save & Restart"})]})]})}var eI=r(1217),ez=r(84974),eF=r(23482),eP=r(61244),eW=r(87739);let eA=[{id:"gameplay",icon:eI.Z,title:"Gameplay",description:"Core game rules and player experience settings.",essentialFields:[{key:"difficulty",label:"Difficulty",type:"select",options:[{value:"peaceful",label:"Peaceful"},{value:"easy",label:"Easy"},{value:"normal",label:"Normal"},{value:"hard",label:"Hard"}]},{key:"gameMode",label:"Game Mode",type:"select",options:[{value:"survival",label:"Survival"},{value:"creative",label:"Creative"},{value:"adventure",label:"Adventure"},{value:"spectator",label:"Spectator"}]},{key:"maxPlayers",label:"Max Players",type:"number",validation:{min:1,max:1e3}},{key:"pvp",label:"Enable PvP",type:"boolean",helperText:"Allow players to damage each other"}],advancedFields:[{key:"forceGamemode",label:"Force Game Mode",type:"boolean",helperText:"Force game mode when players join"},{key:"hardcore",label:"Hardcore",type:"boolean",helperText:"One life only - world deleted on death"},{key:"allowFlight",label:"Allow Flight",type:"boolean",helperText:"Allow flight in survival mode"},{key:"allowNether",label:"Allow Nether",type:"boolean",helperText:"Enable Nether portal access"},{key:"enableCommandBlock",label:"Command Blocks",type:"boolean",helperText:"Enable command block functionality"},{key:"spawnProtection",label:"Spawn Protection",type:"number",helperText:"Radius around spawn (0 = disabled)",unit:"blocks",validation:{min:0,max:256}},{key:"spawnAnimals",label:"Spawn Animals",type:"boolean",helperText:"Spawn passive mobs (cows, pigs, etc.)"},{key:"spawnMonsters",label:"Spawn Monsters",type:"boolean",helperText:"Spawn hostile mobs (zombies, creepers, etc.)"},{key:"spawnNpcs",label:"Spawn NPCs",type:"boolean",helperText:"Spawn villagers and wandering traders"}]},{id:"world",icon:ez.Z,title:"World",description:"World generation and server identity settings.",essentialFields:[{key:"motd",label:"MOTD (Message of the Day)",type:"string",helperText:"Displayed in the server list",columns:12},{key:"level",label:"World Name",type:"string",helperText:"Save folder name",restartRequired:!0},{key:"levelType",label:"Level Type",type:"select",restartRequired:!0,options:[{value:"default",label:"Default"},{value:"flat",label:"Flat"},{value:"largeBiomes",label:"Large Biomes"},{value:"amplified",label:"Amplified"},{value:"buffet",label:"Buffet"}]},{key:"seed",label:"World Seed",type:"string",helperText:"Only affects new world generation",restartRequired:!0}],advancedFields:[{key:"generateStructures",label:"Generate Structures",type:"boolean",helperText:"Generate villages, temples, etc."},{key:"maxWorldSize",label:"Max World Size",type:"number",unit:"blocks",helperText:"Maximum world radius",validation:{min:1,max:29999984}},{key:"icon",label:"Server Icon URL",type:"string",helperText:"64x64 PNG image URL",columns:12}]},{id:"security",icon:eF.Z,title:"Security",description:"Authentication and access control settings.",essentialFields:[{key:"onlineMode",label:"Online Mode (Mojang Auth)",type:"boolean",helperText:"Disable to allow cracked clients (not recommended)",restartRequired:!0},{key:"enableWhitelist",label:"Enable Whitelist",type:"boolean",helperText:"Only whitelisted players can join",restartRequired:!0}],advancedFields:[{key:"enforceWhitelist",label:"Enforce Whitelist",type:"boolean",helperText:"Kick non-whitelisted players already online",restartRequired:!0},{key:"enforceSecureProfile",label:"Enforce Secure Profile",type:"boolean",helperText:"Require signed chat messages from players",restartRequired:!0}]},{id:"performance",icon:q.Z,title:"Performance & JVM",description:"Memory, view distance, and JVM optimization settings.",essentialFields:[{key:"memory",label:"Memory",type:"string",helperText:"e.g., 2G, 4G, 8G",restartRequired:!0},{key:"useAikarFlags",label:"Aikar's Flags",type:"boolean",helperText:"Optimized GC flags for Paper/Spigot",restartRequired:!0},{key:"viewDistance",label:"View Distance",type:"number",unit:"chunks",validation:{min:2,max:32}}],advancedFields:[{key:"simulationDistance",label:"Simulation Distance",type:"number",unit:"chunks",validation:{min:3,max:32}},{key:"maxTickTime",label:"Max Tick Time",type:"number",unit:"ms",helperText:"-1 to disable watchdog",validation:{min:-1}},{key:"initMemory",label:"Initial Heap",type:"string",helperText:"e.g., 1G (overrides Memory)",restartRequired:!0},{key:"maxMemory",label:"Max Heap",type:"string",helperText:"e.g., 8G (overrides Memory)",restartRequired:!0},{key:"jvmXxOpts",label:"JVM -XX Options",type:"string",helperText:"Additional -XX JVM flags",restartRequired:!0,columns:12}]},{id:"autopause",icon:eP.Z,title:"Auto-pause / Auto-stop",description:"Automatically pause or stop when no players are connected.",essentialFields:[{key:"enableAutopause",label:"Enable Auto-pause",type:"boolean",helperText:"Pause process when no players connected",restartRequired:!0},{key:"autopauseTimeoutEst",label:"Pause Timeout",type:"number",unit:"seconds",helperText:"Wait time after last player leaves",validation:{min:0}}],advancedFields:[{key:"autopauseTimeoutInit",label:"Init Timeout",type:"number",unit:"seconds",helperText:"Timeout after start without connections",validation:{min:0}},{key:"autopausePeriod",label:"Check Period",type:"number",unit:"seconds",helperText:"Status check interval",validation:{min:1}},{key:"enableAutostop",label:"Enable Auto-stop",type:"boolean",helperText:"Stop container when no players connected",restartRequired:!0},{key:"autostopTimeoutEst",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Wait time before stopping container",validation:{min:0}}]},{id:"system",icon:eW.Z,title:"System",description:"Timezone, resource pack, RCON, and container settings.",essentialFields:[{key:"tz",label:"Timezone",type:"string",helperText:"e.g., Asia/Seoul, UTC",restartRequired:!0},{key:"resourcePack",label:"Resource Pack URL",type:"string",helperText:"Direct download URL for resource pack",columns:12},{key:"enableRcon",label:"Enable RCON",type:"boolean",helperText:"Remote server console access",restartRequired:!0}],advancedFields:[{key:"resourcePackSha1",label:"Resource Pack SHA1",type:"string",helperText:"40-character hex checksum",columns:12},{key:"resourcePackEnforce",label:"Enforce Resource Pack",type:"boolean",helperText:"Kick players who decline"},{key:"resourcePackPrompt",label:"Resource Pack Prompt",type:"string",helperText:"Custom message for resource pack dialog",columns:12},{key:"rconPassword",label:"RCON Password",type:"password",restartRequired:!0},{key:"rconPort",label:"RCON Port",type:"number",validation:{min:1024,max:65535},restartRequired:!0},{key:"stopDuration",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Graceful shutdown wait time",restartRequired:!0,validation:{min:0}},{key:"uid",label:"User ID (UID)",type:"number",helperText:"Container process UID",restartRequired:!0,validation:{min:0}},{key:"gid",label:"Group ID (GID)",type:"number",helperText:"Container process GID",restartRequired:!0,validation:{min:0}}]}],eM=["memory","initMemory","maxMemory","useAikarFlags","jvmXxOpts","onlineMode","enableWhitelist","enforceWhitelist","enforceSecureProfile","level","seed","levelType","enableAutopause","enableAutostop","enableRcon","rconPassword","rconPort","tz","uid","gid","stopDuration"];function eD(e){let{serverName:t,isRunning:r}=e,{data:i,isLoading:a}=(0,eo.iC)(t),d=(0,eo.MH)(),u=(0,eo.gx)(),v=(0,eo._I)(),[y,j]=(0,n.useState)({}),[g,S]=(0,n.useState)({}),[k,R]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),[z,F]=(0,n.useState)(!1),[P,W]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==i?void 0:i.config)&&(j(i.config),S(i.config))},[i]);let A=(0,n.useMemo)(()=>{let e=[];for(let t of Object.keys(y))y[t]!==g[t]&&e.push(t);for(let t of Object.keys(g))y[t]===g[t]||e.includes(t)||e.push(t);return e},[y,g]),M=A.length>0,D=A.filter(e=>eM.includes(e)),E=D.length>0,q=(0,n.useCallback)((e,t)=>{j(r=>({...r,[e]:t}))},[]),N=(0,n.useCallback)(()=>{j(g)},[g]),B=(0,n.useCallback)(async e=>{try{let s=await d.mutateAsync({serverName:t,config:y});if(S(s.config),j(s.config),e&&r)try{await v.mutateAsync(t),W({open:!0,message:"Settings saved. Server is restarting...",severity:"warning"})}catch(e){W({open:!0,message:"Settings saved, but server restart failed. Please restart manually.",severity:"error"})}else W({open:!0,message:s.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:s.restartRequired?"warning":"success"})}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}finally{F(!1)}},[y,t,r,d,v]),U=(0,n.useCallback)(()=>{E&&r?F(!0):B(!1)},[E,r,B]),L=async()=>{if("RESET"!==T){W({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await u.mutateAsync(t),W({open:!0,message:"World reset successfully",severity:"success"}),R(!1),I("")}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return a?(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,s.jsx)(x.Z,{})}):(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(ep,{serverName:t}),eA.map(e=>(0,s.jsx)(eS,{section:e,values:y,onChange:q},e.id)),(0,s.jsx)(h.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,s.jsx)(O.Z,{sx:{mb:3}}),(0,s.jsxs)(l.Z,{sx:{mb:3},children:[(0,s.jsx)(m.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will permanently delete the current world and generate a new one. This action cannot be undone."}),(0,s.jsx)(o.Z,{variant:"outlined",color:"error",startIcon:(0,s.jsx)(el.Z,{}),onClick:()=>R(!0),disabled:r,children:"Reset World"}),r&&(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,s.jsx)(eR,{hasChanges:M,changedCount:A.length,hasRestartChanges:E,isSaving:d.isPending,onSave:U,onDiscard:N}),(0,s.jsx)(eT,{open:z,changedFields:D,onSaveOnly:()=>B(!1),onSaveAndRestart:()=>B(!0),onCancel:()=>F(!1)}),(0,s.jsxs)(b.Z,{open:k,onClose:()=>R(!1),maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,s.jsx)(ei.Z,{color:"error"}),(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsxs)(m.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,s.jsx)("strong",{children:t})," and generate a new one."]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,s.jsx)(C.Z,{fullWidth:!0,label:"Type RESET to confirm",value:T,onChange:e=>I(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,s.jsxs)(w.Z,{children:[(0,s.jsx)(o.Z,{onClick:()=>R(!1),children:"Cancel"}),(0,s.jsx)(o.Z,{variant:"contained",color:"error",onClick:L,disabled:"RESET"!==T||u.isPending,startIcon:u.isPending?(0,s.jsx)(x.Z,{size:16}):(0,s.jsx)(ea.Z,{}),children:u.isPending?"Resetting...":"Reset World"})]})]}),(0,s.jsx)(en.Z,{open:P.open,autoHideDuration:6e3,onClose:()=>W({...P,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,s.jsx)(c.Z,{onClose:()=>W({...P,open:!1}),severity:P.severity,sx:{width:"100%"},children:P.message})})]})}var eO=r(86702),eE=r(47606),eq=r(407),eN=r(56056),eB=r(11597),eU=r(59602);let eL={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function eH(e){let{permission:t,size:r="medium"}=e,n=eL[t];return(0,s.jsx)(M.Z,{label:n.label,color:n.color,variant:n.variant,size:r})}var eK=r(99046),eG=r(68038),eV=r(34080),eJ=r(39181),eQ=r(5632),e_=r(58919),eX=r(20367),e$=r(42936);function eY(e){var t,r;let{open:i,onClose:a,serverId:d}=e,[u,h]=(0,n.useState)(""),[p,v]=(0,n.useState)(null),[y,j]=(0,n.useState)("view"),{data:g,isLoading:S}=(r={enabled:i},(0,eQ.a)({queryKey:["users","search",u],queryFn:()=>(0,e$.SC)("/api/users?q=".concat(encodeURIComponent(u))),enabled:(null==r?void 0:r.enabled)!==!1&&u.length>=2,staleTime:3e4})),k=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>(0,e$.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["user-servers",r.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),R=(0,n.useMemo)(()=>{var e;return null!==(e=null==g?void 0:g.users)&&void 0!==e?e:[]},[g]),T=()=>{h(""),v(null),j("view"),k.reset(),a()};return(0,s.jsxs)(b.Z,{open:i,onClose:T,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,s.jsx)(f.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,s.jsxs)(Z.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[k.isError&&(0,s.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(t=k.error)||void 0===t?void 0:t.message)||"Failed to grant access"}),(0,s.jsx)(eK.Z,{options:R,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,t)=>e.id===t.id,value:p,onChange:(e,t)=>v(t),inputValue:u,onInputChange:(e,t)=>h(t),loading:S,filterOptions:e=>e,noOptionsText:u.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,s.jsx)(C.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,s.jsxs)(s.Fragment,{children:[S&&(0,s.jsx)(x.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,t)=>{var r,n,i;let{key:a,...o}=e;return(0,s.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,s.jsx)(eO.Z,{src:null!==(i=t.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(r=t.name)||void 0===r?void 0:r[0])||(null===(n=t.email)||void 0===n?void 0:n[0])||"?").toUpperCase()}),(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:t.name||"Unknown"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:t.email})]})]},a)}}),(0,s.jsxs)(ej.Z,{children:[(0,s.jsx)(eG.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,s.jsxs)(eV.Z,{value:y,onChange:e=>j(e.target.value),children:[(0,s.jsx)(eb.Z,{value:"view",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,s.jsx)(eb.Z,{value:"manage",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,s.jsx)(eb.Z,{value:"admin",control:(0,s.jsx)(eJ.Z,{size:"small"}),label:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,s.jsxs)(w.Z,{sx:{px:3,pb:2},children:[(0,s.jsx)(o.Z,{onClick:T,color:"inherit",children:"Cancel"}),(0,s.jsx)(o.Z,{onClick:()=>{p&&k.mutate({userId:p.id,serverId:d,permission:y},{onSuccess:T})},variant:"contained",disabled:!p||k.isPending,sx:{borderRadius:2},children:k.isPending?"Adding...":"Add User"})]})]})}function e0(e){var t,r;let{serverId:i}=e,{data:a,isLoading:x,error:b}=(0,eQ.a)({queryKey:["user-servers",i],queryFn:()=>(0,e$.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),f=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{id:t,permission:r}=e;return(0,e$.SC)("/api/user-servers/".concat(encodeURIComponent(t)),{method:"PATCH",body:JSON.stringify({permission:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),Z=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>(0,e$.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[w,C]=(0,n.useState)(!1),[S,k]=(0,n.useState)(null),[R,T]=(0,n.useState)(null),z=(e,t)=>{k(e.currentTarget),T(t)},F=()=>{k(null),T(null)},P=e=>{if(!R||R.permission===e){F();return}f.mutate({id:R.id,permission:e},{onSettled:F})},W=null!==(t=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==t?t:0,A=(null==R?void 0:R.permission)==="admin"&&W<=1;if(x)return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%",height:32}),(0,s.jsx)(u.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,s.jsx)(O.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,s.jsx)(u.Z,{variant:"circular",width:40,height:40}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%"}),(0,s.jsx)(u.Z,{variant:"text",width:"60%"})]}),(0,s.jsx)(u.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,s.jsx)(u.Z,{variant:"circular",width:32,height:32})]},e))]})});if(b)return(0,s.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",b.message]});let M=null!==(r=null==a?void 0:a.users)&&void 0!==r?r:[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(eE.Z,{}),onClick:()=>C(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,s.jsx)(O.Z,{sx:{mb:1}}),0===M.length?(0,s.jsx)(l.Z,{sx:{py:4,textAlign:"center"},children:(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):M.map(e=>{var t,r,n,i,a,o,c,x;return(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,s.jsx)(eO.Z,{src:null!==(x=null===(t=e.user)||void 0===t?void 0:t.image)&&void 0!==x?x:void 0,sx:{width:40,height:40,bgcolor:"primary.main",fontSize:16},children:((null===(n=e.user)||void 0===n?void 0:null===(r=n.name)||void 0===r?void 0:r[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,s.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,s.jsx)(m.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.name)||"Unknown User"}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(c=e.user)||void 0===c?void 0:c.email)||e.userId})]}),(0,s.jsx)(eH,{permission:e.permission,size:"small"}),(0,s.jsx)(d.Z,{size:"small",onClick:t=>z(t,e),sx:{color:"text.secondary"},children:(0,s.jsx)(I.Z,{fontSize:"small"})})]},e.id)}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,s.jsx)(eU.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,s.jsxs)(v.Z,{anchorEl:S,open:!!S,onClose:F,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,s.jsxs)(y.Z,{onClick:()=>P("admin"),disabled:(null==R?void 0:R.permission)==="admin",children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eq.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Owner"})]}),(0,s.jsxs)(y.Z,{onClick:()=>P("manage"),disabled:(null==R?void 0:R.permission)==="manage"||A,children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eN.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Operator"})]}),(0,s.jsxs)(y.Z,{onClick:()=>P("view"),disabled:(null==R?void 0:R.permission)==="view"||A,children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eZ.Z,{fontSize:"small"})}),(0,s.jsx)(g.Z,{children:"Change to Viewer"})]}),(0,s.jsx)(O.Z,{}),(0,s.jsxs)(y.Z,{onClick:()=>{R&&Z.mutate(R.id,{onSettled:F})},disabled:A,sx:{color:"error.main"},children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(eB.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,s.jsx)(g.Z,{children:"Remove Access"})]})]}),(0,s.jsx)(eY,{open:w,onClose:()=>C(!1),serverId:i})]})}var e1=r(10449),e2=r(24559),e3=r(37228);function e6(e){let{text:t}=e,[r,i]=(0,n.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){console.error("Failed to copy:",e)}};return(0,s.jsx)(d.Z,{size:"small",onClick:a,sx:{ml:1,color:r?"success.main":"text.secondary","&:hover":{bgcolor:"action.hover"}},"aria-label":r?"Copied":"Copy to clipboard",children:r?(0,s.jsx)(e2.Z,{sx:{fontSize:16}}):(0,s.jsx)(e1.Z,{sx:{fontSize:16}})})}function e5(e){let{label:t,value:r,copyText:n}=e;return(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1},children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,s.jsx)(m.Z,{variant:"body2",sx:{fontFamily:n?"monospace":"inherit",color:n?"text.primary":"text.secondary"},children:r}),n&&(0,s.jsx)(e6,{text:n})]})]})}function e4(e){let{serverName:t,hostname:r}=e,{data:n,isLoading:i}=(0,e3.UW)();if(i)return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]})]})});let a=r?"".concat(r,":25565"):"Not configured",o=(null==n?void 0:n.enabled)&&n.servers.length>0,d=null==n?void 0:n.servers.find(e=>e.serverName===t),c=(null==d?void 0:d.playitDomain)||"Not configured",x=!!(null==d?void 0:d.playitDomain);return(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Connection"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(e5,{label:"LAN Address",value:a,copyText:r?a:void 0}),o&&(0,s.jsx)(e5,{label:"External Address",value:c,copyText:x?c:void 0})]})})}var e8=r(42431),e7=r(76777),e9=r(15761);function te(e){let{serverName:t}=e,{data:r,isLoading:i,error:a}=(0,eQ.a)({queryKey:["servers",t,"mods"],queryFn:()=>(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods")),enabled:!!t}),u=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{serverName:t,slugs:r,source:s}=e;return(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods"),{method:"POST",body:JSON.stringify({slugs:r,source:s})})},onSuccess:(t,r)=>{let{serverName:s}=r;e.invalidateQueries({queryKey:["servers",s,"mods"]})}})}(),v=function(){let e=(0,e_.NL)();return(0,eX.D)({mutationFn:e=>{let{serverName:t,slug:r}=e;return(0,e$.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods/").concat(encodeURIComponent(r)),{method:"DELETE"})},onSuccess:(t,r)=>{let{serverName:s}=r;e.invalidateQueries({queryKey:["servers",s,"mods"]})}})}(),[y,j]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,k]=(0,n.useState)(""),[R,T]=(0,n.useState)(!1),[I,F]=(0,n.useState)({open:!1,message:"",severity:"info"}),{data:P,isLoading:W}=function(e,t){let r=new URLSearchParams;return e&&r.set("q",e),(null==t?void 0:t.limit)!=null&&r.set("limit",String(t.limit)),(null==t?void 0:t.offset)!=null&&r.set("offset",String(t.offset)),(0,eQ.a)({queryKey:["mods","search",e,null==t?void 0:t.limit,null==t?void 0:t.offset],queryFn:()=>(0,e$.SC)("/api/mods/search?".concat(r)),enabled:(null==t?void 0:t.enabled)!==!1&&!!e.trim()})}(S,{limit:10,enabled:y&&S.length>0});(0,n.useEffect)(()=>{let e=setTimeout(()=>{k(g)},300);return()=>clearTimeout(e)},[g]);let A=(0,n.useCallback)(async e=>{try{await v.mutateAsync({serverName:t,slug:e}),T(!0),F({open:!0,message:"Removed ".concat(e),severity:"success"})}catch(e){F({open:!0,message:e instanceof Error?e.message:"Failed to remove mod",severity:"error"})}},[v,t]),q=(0,n.useCallback)(async e=>{try{await u.mutateAsync({serverName:t,slugs:[e]}),T(!0),F({open:!0,message:"Added ".concat(e),severity:"success"})}catch(e){F({open:!0,message:e instanceof Error?e.message:"Failed to add mod",severity:"error"})}},[u,t]),N=new Set;if(null==r?void 0:r.mods)for(let e of Object.values(r.mods))for(let t of e)N.add(t);if(i)return(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,s.jsx)(x.Z,{})});if(a)return(0,s.jsxs)(c.Z,{severity:"error",sx:{mt:2},children:["Failed to load mods: ",a.message]});let B=N.size>0;return(0,s.jsxs)(l.Z,{children:[R&&(0,s.jsx)(c.Z,{severity:"info",sx:{mb:2},children:"Restart the server to apply mod changes."}),(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Installed Mods"}),(0,s.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(ex.Z,{}),onClick:()=>{w(""),k(""),j(!0)},children:"Add Mods"})]}),(0,s.jsx)(O.Z,{sx:{mb:2}}),B?Object.entries(r.mods).map(e=>{let[t,r]=e;return(0,s.jsxs)(l.Z,{sx:{mb:2},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1,textTransform:"capitalize"},children:t}),(0,s.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:r.map(e=>(0,s.jsx)(M.Z,{label:e,icon:(0,s.jsx)(e7.Z,{}),onDelete:()=>A(e),deleteIcon:(0,s.jsx)(z.Z,{}),variant:"outlined"},e))})]},t)}):(0,s.jsxs)(l.Z,{sx:{textAlign:"center",py:4},children:[(0,s.jsx)(e7.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"No mods installed"}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mt:.5},children:'Click "Add Mods" to search and install mods from Modrinth'})]})]})}),(0,s.jsxs)(b.Z,{open:y,onClose:()=>j(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{minHeight:400}},children:[(0,s.jsxs)(f.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Search Mods",(0,s.jsx)(d.Z,{onClick:()=>j(!1),size:"small",children:(0,s.jsx)(E.Z,{})})]}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(C.Z,{fullWidth:!0,autoFocus:!0,placeholder:"Search Modrinth...",value:g,onChange:e=>w(e.target.value),InputProps:{startAdornment:(0,s.jsx)(D.Z,{position:"start",children:(0,s.jsx)(e8.Z,{})})},sx:{mb:2}}),W&&(0,s.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(x.Z,{size:28})}),!W&&P&&0===P.hits.length&&S&&(0,s.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:4},children:['No mods found for "',S,'"']}),!W&&P&&P.hits.length>0&&(0,s.jsx)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:P.hits.map(e=>{var t;let r=N.has(e.slug);return(0,s.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,s.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,s.jsx)(eO.Z,{src:e.iconUrl||void 0,variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,s.jsx)(e7.Z,{})}),(0,s.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(m.Z,{variant:"subtitle2",noWrap:!0,children:e.title}),(0,s.jsx)(o.Z,{size:"small",variant:r?"outlined":"contained",disabled:r||u.isPending,onClick:()=>q(e.slug),sx:{ml:1,minWidth:80,flexShrink:0},children:r?"Installed":"Add"})]}),(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:.25,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.description}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.25},children:[(0,s.jsx)(e9.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,s.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:(t=e.downloads)>=1e6?"".concat((t/1e6).toFixed(1),"M"):t>=1e3?"".concat((t/1e3).toFixed(1),"K"):String(t)})]}),e.author&&(0,s.jsxs)(m.Z,{variant:"caption",color:"text.disabled",children:["by ",e.author]})]})]})]})})},e.slug)})})]})]}),(0,s.jsx)(en.Z,{open:I.open,autoHideDuration:4e3,onClose:()=>F(e=>({...e,open:!1})),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,s.jsx)(c.Z,{onClose:()=>F(e=>({...e,open:!1})),severity:I.severity,variant:"filled",children:I.message})})]})}let tt=["Overview","Activity","Mods","Files","Backups","Access","Options"];function tr(e){return e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[a-zA-Z]/g,"").replace(/\[m/g,"").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"").trim()}function ts(e){var t,r,i,a,c;let{server:x,onSendCommand:u}=e,[v,y]=(0,n.useState)("Overview"),[j,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(!0),[R,T]=(0,n.useState)(!1),I=(0,n.useRef)(null),{logs:z,isConnected:F}=(0,V.Y)({serverName:x.name}),P=(0,n.useMemo)(()=>z.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[z]);(0,n.useEffect)(()=>{I.current&&f&&(I.current.scrollTop=I.current.scrollHeight)},[P,f]);let W=async()=>{j.trim()&&u&&(await u(j.trim()),g(""))},A=null!==(a=null===(t=x.stats)||void 0===t?void 0:t.cpuPercent)&&void 0!==a?a:0;(null===(r=x.stats)||void 0===r?void 0:r.memoryUsage)&&x.stats.memoryUsage,function(e){if(!e)return;let t=e.match(/^(\d+)\s*(M|G)?$/i);if(t)parseInt(t[1],10),(t[2]||"M").toUpperCase()}(x.memory);let K=null!==(c=null===(i=x.stats)||void 0===i?void 0:i.memoryPercent)&&void 0!==c?c:0;return(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:tt.map(e=>(0,s.jsx)(o.Z,{onClick:()=>y(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:v===e?"primary.main":"transparent",color:v===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:v===e?"primary.main":(0,k.Fq)("#1bd96a",.1)}},children:e},e))}),(0,s.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,s.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,s.jsx)(q.Z,{sx:{fontSize:28}}),progress:A,progressMax:100,color:"#1bd96a"}),(0,s.jsx)(G,{value:"".concat(K.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,s.jsx)(N.Z,{sx:{fontSize:28}}),progress:K,progressMax:100,color:"#1bd96a"}),(0,s.jsx)(G,{value:x.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,s.jsx)(B.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let t=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!t)return 0;let r=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*r;case"MB":case"MIB":return r;case"KB":return r/1024;default:return r/1048576}}(x.worldSize),progressMax:10240,color:"#1bd96a"})]}),(0,s.jsxs)(h.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,s.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,s.jsx)(m.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,s.jsx)(l.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:F?"primary.main":"error.main",boxShadow:F?"0 0 8px rgba(27, 217, 106, 0.4)":"0 0 8px rgba(239, 68, 68, 0.4)"}})]}),(0,s.jsxs)(l.Z,{sx:{position:"relative"},children:[(0,s.jsx)(l.Z,{ref:I,onScroll:()=>{if(!I.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:r}=I.current;w(t-e-r<30)},sx:{height:360,overflowY:"auto",px:2.5,py:2,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace",fontSize:13,lineHeight:1.85,color:"#b4b6c4",bgcolor:"#0a0a0a",scrollbarWidth:"thin",scrollbarColor:"#3a3d4e #0a0a0a","&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"#0a0a0a"},"&::-webkit-scrollbar-thumb":{bgcolor:"#3a3d4e",borderRadius:4}},children:0===P.length?(0,s.jsx)(m.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):P.map((e,t)=>{let r=function(e){let t=tr(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return t?{time:t[1],thread:t[2],level:t[3]||"INFO",msg:t[4]}:null}(e);return r?(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,s.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",r.time,"]"]}),(0,s.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",r.thread,"/",(0,s.jsx)(l.Z,{component:"span",sx:{color:"WARN"===r.level?"#e8a848":"#6b6e80"},children:r.level}),"]:\xa0"]}),(0,s.jsx)(l.Z,{component:"span",sx:{color:"WARN"===r.level?"#c4a45a":"#b4b6c4"},children:r.msg})]},t):(0,s.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:tr(e)},t)})}),(0,s.jsx)(d.Z,{onClick:()=>T(!0),sx:{position:"absolute",top:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,s.jsx)(U.Z,{sx:{fontSize:18}})}),!f&&(0,s.jsx)(d.Z,{onClick:()=>{I.current&&I.current.scrollTo({top:I.current.scrollHeight,behavior:"smooth"})},sx:{position:"absolute",bottom:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,s.jsx)(L.Z,{sx:{fontSize:18}})})]}),(0,s.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,s.jsx)(C.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:j,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),W())},disabled:!F,InputProps:{startAdornment:(0,s.jsx)(D.Z,{position:"start",children:(0,s.jsx)(H.Z,{sx:{fontSize:16,color:"#999"}})}),sx:{bgcolor:"#13141c",borderRadius:2,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",fontSize:14,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#2a2d3e"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#3a3d4e"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}})})]}),"Overview"===v&&(0,s.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(tn,{label:"Name",value:x.name}),(0,s.jsx)(tn,{label:"Container",value:x.container}),(0,s.jsx)(tn,{label:"Hostname",value:x.hostname}),(0,s.jsx)(tn,{label:"Type",value:x.type}),(0,s.jsx)(tn,{label:"Version",value:x.version}),(0,s.jsx)(tn,{label:"Memory",value:x.memory}),(0,s.jsx)(tn,{label:"Uptime",value:x.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60;return t>0?"".concat(t,"h ").concat(r,"m"):r>0?"".concat(r,"m ").concat(s,"s"):"".concat(s,"s")}(x.uptimeSeconds)})]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),x.players?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tn,{label:"Online",value:"".concat(x.players.online," / ").concat(x.players.max)}),x.players.players&&x.players.players.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,s.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.players.map(e=>(0,s.jsx)(M.Z,{label:e,size:"small"},e))})]})]}):(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(e4,{serverName:x.name,hostname:x.hostname})})]}),"Activity"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,s.jsx)(O.Z,{sx:{mb:2}}),(0,s.jsx)(es,{serverName:x.name})]})})}),"Mods"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(te,{serverName:x.name})}),"Files"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(e0,{serverId:x.name})}),"Options"===v&&(0,s.jsx)(l.Z,{sx:{mt:3},children:(0,s.jsx)(eD,{serverName:x.name,isRunning:"running"===x.status})}),(0,s.jsxs)(b.Z,{open:R,onClose:()=>T(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,s.jsxs)(m.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",x.name]}),(0,s.jsx)(d.Z,{onClick:()=>T(!1),children:(0,s.jsx)(E.Z,{})})]}),(0,s.jsx)(Z.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,s.jsx)(J.K,{serverName:x.name})})]})]})}function tn(e){let{label:t,value:r}=e;return r?(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,s.jsx)(m.Z,{variant:"body2",sx:{fontWeight:500},children:r})]}):null}var ti=r(93757);function ta(){return(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function tl(){return(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M21 2v6h-6"}),(0,s.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,s.jsx)("path",{d:"M3 22v-6h6"}),(0,s.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function to(){var e,t,r,M;let D=(0,i.useParams)(),O=(0,a.x)(),E=decodeURIComponent(D.name),{data:q,isLoading:N,error:B}=(0,eo.Hy)(E),{status:U,health:L}=function(e){let{serverName:t,onStatusChange:r,enabled:s=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,n.useState)(null),[o,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{l(null),d(null)},[t]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let t=e.data.status,s=e.data.health;l(t),d(s),null==r||r(t,s)}},[r]),{isConnected:x,reconnect:u,retryCount:h}=(0,ti.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/status"),onMessage:c,enabled:s,reconnectInterval:i});return{status:a,health:o,isConnected:x,reconnect:u,retryCount:h}}({serverName:E,enabled:!!E}),[H,K]=(0,n.useState)(null),[G,V]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(""),_=(0,eo.jM)(),X=(0,eo.Aw)(),$=(0,eo._I)(),Y=(0,eo.Hq)(),ee=async()=>{try{await _.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},et=async()=>{try{await X.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},er=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},es=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(E),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=U||(null==q?void 0:q.server.status),ei=_.isPending||X.isPending||$.isPending,ea=null==q?void 0:q.server;return(0,s.jsxs)(s.Fragment,{children:[B&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",B.message]}),_.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=_.error)||void 0===e?void 0:e.message]}),X.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=X.error)||void 0===t?void 0:t.message]}),$.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(r=$.error)||void 0===r?void 0:r.message]}),Y.isError&&(0,s.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(M=Y.error)||void 0===M?void 0:M.message]}),N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:40}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,s.jsx)(u.Z,{variant:"text",width:100}),(0,s.jsx)(u.Z,{variant:"text",width:60}),(0,s.jsx)(u.Z,{variant:"text",width:140}),(0,s.jsx)(u.Z,{variant:"text",width:50})]})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,s.jsx)(u.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,s.jsx)(u.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,s.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,t)=>(0,s.jsx)(u.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},t))}),(0,s.jsx)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[0,1,2].map(e=>(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,s.jsx)(u.Z,{variant:"text",width:"50%"}),(0,s.jsx)(u.Z,{variant:"circular",width:28,height:28})]}),(0,s.jsx)(u.Z,{variant:"text",width:"60%",height:36}),(0,s.jsx)(u.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,s.jsxs)(h.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,s.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,s.jsx)(u.Z,{variant:"text",width:80,height:28}),(0,s.jsx)(u.Z,{variant:"circular",width:10,height:10})]}),(0,s.jsx)(u.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,s.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,s.jsx)(u.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,s.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%"}),(0,s.jsx)(u.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,s.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,s.jsx)(h.Z,{sx:{borderRadius:3},children:(0,s.jsxs)(p.Z,{children:[(0,s.jsx)(u.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,s.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,s.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,s.jsx)(u.Z,{variant:"text",width:"25%"}),(0,s.jsx)(u.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,s.jsx)(l.Z,{sx:{width:64,height:64,borderRadius:3,overflow:"hidden",bgcolor:"background.paper",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"1px solid",borderColor:"divider",fontSize:36},children:function(e){if(!e)return"\uD83C\uDFAE";let t=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(t)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(t)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,s.jsxs)(l.Z,{sx:{flex:1},children:[(0,s.jsxs)(m.Z,{onClick:()=>O.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,s.jsx)(R.Z,{sx:{fontSize:14}})," All servers"]}),(0,s.jsx)(m.Z,{variant:"h4",component:"h1",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"text.primary",letterSpacing:"0.5px",m:0,textTransform:"uppercase"},children:E}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(F.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(P.Z,{sx:{fontSize:14}}),ea.type]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(W.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,s.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,s.jsx)(A.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60;return t>0?"".concat(t,"h ").concat(r,"m"):r>0?"".concat(r,"m ").concat(s,"s"):"".concat(s,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,s.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,s.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(T.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===en&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{variant:"outlined",startIcon:ei?(0,s.jsx)(x.Z,{size:16}):(0,s.jsx)(ta,{}),onClick:et,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,k.Fq)("#fff",.05)}},children:"Stop"}),(0,s.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,s.jsx)(x.Z,{size:16,color:"inherit"}):(0,s.jsx)(tl,{}),onClick:er,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600,bgcolor:"primary.main",color:"#0a0e14","&:hover":{bgcolor:"primary.dark"}},children:"Restart"})]}),(0,s.jsx)(d.Z,{onClick:e=>K(e.currentTarget),sx:{width:36,height:36,borderRadius:2,border:"1px solid",borderColor:"divider",color:"text.secondary"},children:(0,s.jsx)(I.Z,{sx:{fontSize:18}})}),(0,s.jsx)(v.Z,{anchorEl:H,open:!!H,onClose:()=>K(null),children:(0,s.jsxs)(y.Z,{onClick:()=>{K(null),V(!0),Q("")},sx:{color:"error.main"},children:[(0,s.jsx)(j.Z,{children:(0,s.jsx)(z.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,s.jsx)(g.Z,{children:"Delete Server"})]})})]})]}),(0,s.jsx)(ts,{server:ea,onSendCommand:es})]}):(0,s.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,s.jsxs)(b.Z,{open:G,onClose:()=>{V(!1),Q("")},maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(f.Z,{children:"Delete Server"}),(0,s.jsxs)(Z.Z,{children:[(0,s.jsxs)(m.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,s.jsx)("strong",{children:E})," to confirm deletion."]}),(0,s.jsx)(C.Z,{label:"Server name",value:J,onChange:e=>Q(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,s.jsxs)(w.Z,{sx:{px:3,pb:2},children:[(0,s.jsx)(o.Z,{onClick:()=>{V(!1),Q("")},children:"Cancel"}),(0,s.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{J===E&&Y.mutate({name:E,force:!0},{onSuccess:()=>{O.push("/servers")}})},disabled:J!==E||Y.isPending,startIcon:Y.isPending?(0,s.jsx)(x.Z,{size:16}):null,children:Y.isPending?"Deleting...":"Delete"})]})]})]})}},56813:function(e,t,r){"use strict";r.d(t,{I:function(){return a}});var s=r(94655),n=r(25333),i=r(82925);function a(e){let{action:t,size:r="small"}=e,a=i.Lu[t]||"default",l=i.n3[t]||t;return(0,s.jsx)(n.Z,{label:l,color:a,size:r,variant:"filled",sx:{fontWeight:600,fontSize:"small"===r?"0.7rem":"0.8rem"}})}},26892:function(e,t,r){"use strict";r.d(t,{c:function(){return l}});var s=r(94655),n=r(25333),i=r(46207),a=r(43436);function l(e){let{status:t,size:r="small"}=e;return(0,s.jsx)(n.Z,{icon:"success"===t?(0,s.jsx)(i.Z,{}):(0,s.jsx)(a.Z,{}),label:"success"===t?"OK":"Error",color:"success"===t?"success":"error",size:r,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===r?"0.7rem":"0.8rem"}})}},84509:function(e,t,r){"use strict";r.d(t,{DM:function(){return a},HZ:function(){return o},VM:function(){return l},hT:function(){return i},oL:function(){return d}});var s=r(5632),n=r(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=function(e){let t=new URLSearchParams;e.action&&t.set("action",e.action),e.actor&&t.set("actor",e.actor),e.targetType&&t.set("targetType",e.targetType),e.targetName&&t.set("targetName",e.targetName),e.status&&t.set("status",e.status),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.offset&&t.set("offset",String(e.offset)),e.sort&&t.set("sort",e.sort);let r=t.toString();return r?"?".concat(r):""}(e);return(0,s.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs".concat(r)),enabled:(null==t?void 0:t.enabled)!==!1})}function a(e){return(0,s.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,n.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function l(e,t){return(0,s.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function o(e,t){var r;return i({targetType:"server",targetName:e,limit:null!==(r=null==t?void 0:t.limit)&&void 0!==r?r:20},{enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},37228:function(e,t,r){"use strict";r.d(t,{Bc:function(){return o},N$:function(){return d},UW:function(){return l}});var s=r(5632),n=r(58919),i=r(20367),a=r(42936);function l(){return(0,s.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function o(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function d(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},82925:function(e,t,r){"use strict";r.d(t,{KK:function(){return l},Lu:function(){return s},Xn:function(){return a},n3:function(){return n},xg:function(){return i}});let s={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},n={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],l=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,55,7727,8347,1658,3945,6727,6645,2535,4219,4436,2666,5787,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|