@minecraft-docker/mcctl-console 1.13.0 → 1.14.0

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.
Files changed (259) hide show
  1. package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
  2. package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +134 -102
  3. package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +4 -4
  5. package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
  6. package/.next/standalone/platform/services/mcctl-console/.next/routes-manifest.json +1 -1
  7. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js +1 -1
  8. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js.nft.json +1 -1
  9. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js +1 -0
  11. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js.nft.json +1 -0
  12. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -0
  13. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js +1 -1
  14. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js.nft.json +1 -1
  15. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js +1 -1
  17. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js.nft.json +1 -1
  18. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js +51 -1
  20. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js.nft.json +1 -1
  21. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page.js +1 -1
  23. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page.js.nft.json +1 -1
  24. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
  26. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js.nft.json +1 -1
  27. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js +1 -1
  29. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js.nft.json +1 -1
  30. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
  31. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js +1 -1
  32. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js.nft.json +1 -1
  33. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
  34. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page.js +1 -1
  35. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page.js.nft.json +1 -1
  36. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
  38. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
  39. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/history/route.js +1 -0
  40. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/history/route.js.nft.json +1 -0
  41. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/restore/route.js +1 -0
  42. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/restore/route.js.nft.json +1 -0
  43. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/route.js +1 -0
  44. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/backup/route.js.nft.json +1 -0
  45. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/players/ban/route.js +1 -1
  46. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/players/kick/route.js +1 -1
  47. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/players/op/route.js +1 -1
  48. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/players/route.js +1 -1
  49. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/players/whitelist/route.js +1 -1
  50. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/router/status/route.js +1 -1
  51. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/[name]/[action]/route.js +1 -1
  52. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/[name]/config/route.js +1 -1
  53. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/[name]/exec/route.js +1 -1
  54. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/[name]/route.js +1 -1
  55. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/[name]/world/reset/route.js +1 -1
  56. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/servers/route.js +1 -1
  57. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/user-servers/[id]/route.js +1 -0
  58. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/user-servers/[id]/route.js.nft.json +1 -0
  59. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/user-servers/route.js +1 -0
  60. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/user-servers/route.js.nft.json +1 -0
  61. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/users/route.js +1 -0
  62. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/users/route.js.nft.json +1 -0
  63. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/worlds/[name]/[action]/route.js +1 -1
  64. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/worlds/[name]/route.js +1 -1
  65. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/worlds/route.js +1 -1
  66. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
  67. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +3 -3
  68. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -0
  69. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.meta +5 -0
  70. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +18 -0
  71. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
  72. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +3 -3
  73. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
  74. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
  75. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page.js +1 -1
  76. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page.js.nft.json +1 -1
  77. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
  78. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
  79. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +2 -2
  80. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page.js +1 -1
  81. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page.js.nft.json +1 -1
  82. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
  83. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
  84. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +3 -3
  85. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
  86. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +3 -3
  87. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
  88. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +3 -3
  89. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page.js +1 -1
  90. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page.js.nft.json +1 -1
  91. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
  92. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
  93. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +2 -2
  94. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
  95. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +3 -3
  96. package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +18 -11
  97. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3029.js +51 -0
  98. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3076.js +1 -1
  99. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3100.js +1 -0
  100. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/354.js +1 -1
  101. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/4972.js +1 -0
  102. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5244.js +74 -0
  103. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5466.js +2 -0
  104. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/613.js +1 -0
  105. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8243.js +1 -0
  106. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/9157.js +1 -0
  107. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/9350.js +1 -0
  108. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/959.js +1 -1
  109. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-build-manifest.js +1 -1
  110. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
  111. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.js +1 -1
  112. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.json +1 -1
  113. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
  114. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
  115. package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
  116. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1071-235049df1c3caba7.js +1 -0
  117. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1476-a0570078fdf78fae.js +1 -0
  118. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2022-6da2f9a847a5d61c.js +1 -0
  119. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2093-bceea213e32f6b5f.js +1 -0
  120. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/212-b904d9ae152f2360.js +1 -0
  121. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2149-ba1bdd1d726ab70c.js +1 -0
  122. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2537-6c9d2dfd403b7448.js +1 -0
  123. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/310-72d3b802b3cefa99.js +1 -0
  124. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/315-509f963f6c69d0a8.js +1 -0
  125. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/3543-1ec838cbe59f6baa.js +1 -0
  126. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/406-64ea09489141e436.js +1 -0
  127. package/.next/{static/chunks/4538-b363c77f66f5a771.js → standalone/platform/services/mcctl-console/.next/static/chunks/4538-a0d2c88024f1288a.js} +1 -1
  128. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4840-5802e869ffd1d2a9.js +1 -0
  129. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5511-7a419d84918a8d64.js +1 -0
  130. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6189-d8557db379604b3e.js +1 -0
  131. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6594-e49e36eb5a5d1bef.js +1 -0
  132. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6645-68b73fe1df8dba93.js +1 -0
  133. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6655-81288236c1babc44.js +1 -0
  134. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7413-419718450fadde21.js +1 -0
  135. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/{6803-e2b09f75f207f836.js → 8006-219c9bbc650b079e.js} +1 -1
  136. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8322-8ae826d4c9b38acc.js +1 -0
  137. package/.next/{static/chunks/8657-ace229edcbef958f.js → standalone/platform/services/mcctl-console/.next/static/chunks/8657-f28db4e9df8cc7b0.js} +1 -1
  138. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8696-8adf1e9b1a84f5c0.js +1 -0
  139. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9030-1dcbf06ed6e20e24.js +1 -0
  140. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9654-84c0d7b06321aab9.js +1 -0
  141. package/.next/{static/chunks/app/(main)/audit-logs/page-a85c5c81b5ef7100.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/page-7a5d1441bb2811cf.js} +1 -1
  142. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/backups/page-cc46681d519753dd.js +1 -0
  143. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/page-b548fe2aac951e5b.js +1 -0
  144. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-9311354243420c0d.js +1 -0
  145. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-706f5e796129df33.js +1 -0
  146. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-14f40cfd98e60a77.js +1 -0
  147. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/console/{page-b25581705b8b2277.js → page-ca0344337ef5da93.js} +1 -1
  148. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-55fee1f878b51fb8.js +1 -0
  149. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/page-efa5f11aa2956719.js +1 -0
  150. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-3de10e94b77f6e45.js +1 -0
  151. package/.next/{static/chunks/app/login/page-39f136cf2697cefc.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/login/page-3ad9d595e6c37214.js} +1 -1
  152. package/.next/{static/chunks/app/signup/page-9c69da79dac7dff9.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/signup/page-69a8bc2df6bc3559.js} +1 -1
  153. package/.next/{static/chunks/main-34a19e4bc5b0f28c.js → standalone/platform/services/mcctl-console/.next/static/chunks/main-43f98b458d773ca0.js} +1 -1
  154. package/.next/standalone/platform/services/mcctl-console/.next/static/css/8dfdea5f9ccf5da4.css +1 -0
  155. package/.next/static/chunks/1071-235049df1c3caba7.js +1 -0
  156. package/.next/static/chunks/1476-a0570078fdf78fae.js +1 -0
  157. package/.next/static/chunks/2022-6da2f9a847a5d61c.js +1 -0
  158. package/.next/static/chunks/2093-bceea213e32f6b5f.js +1 -0
  159. package/.next/static/chunks/212-b904d9ae152f2360.js +1 -0
  160. package/.next/static/chunks/2149-ba1bdd1d726ab70c.js +1 -0
  161. package/.next/static/chunks/2537-6c9d2dfd403b7448.js +1 -0
  162. package/.next/static/chunks/310-72d3b802b3cefa99.js +1 -0
  163. package/.next/static/chunks/315-509f963f6c69d0a8.js +1 -0
  164. package/.next/static/chunks/3543-1ec838cbe59f6baa.js +1 -0
  165. package/.next/static/chunks/406-64ea09489141e436.js +1 -0
  166. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/4538-b363c77f66f5a771.js → static/chunks/4538-a0d2c88024f1288a.js} +1 -1
  167. package/.next/static/chunks/4840-5802e869ffd1d2a9.js +1 -0
  168. package/.next/static/chunks/5511-7a419d84918a8d64.js +1 -0
  169. package/.next/static/chunks/6189-d8557db379604b3e.js +1 -0
  170. package/.next/static/chunks/6594-e49e36eb5a5d1bef.js +1 -0
  171. package/.next/static/chunks/6645-68b73fe1df8dba93.js +1 -0
  172. package/.next/static/chunks/6655-81288236c1babc44.js +1 -0
  173. package/.next/static/chunks/7413-419718450fadde21.js +1 -0
  174. package/.next/static/chunks/{6803-e2b09f75f207f836.js → 8006-219c9bbc650b079e.js} +1 -1
  175. package/.next/static/chunks/8322-8ae826d4c9b38acc.js +1 -0
  176. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/8657-ace229edcbef958f.js → static/chunks/8657-f28db4e9df8cc7b0.js} +1 -1
  177. package/.next/static/chunks/8696-8adf1e9b1a84f5c0.js +1 -0
  178. package/.next/static/chunks/9030-1dcbf06ed6e20e24.js +1 -0
  179. package/.next/static/chunks/9654-84c0d7b06321aab9.js +1 -0
  180. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/page-a85c5c81b5ef7100.js → static/chunks/app/(main)/audit-logs/page-7a5d1441bb2811cf.js} +1 -1
  181. package/.next/static/chunks/app/(main)/backups/page-cc46681d519753dd.js +1 -0
  182. package/.next/static/chunks/app/(main)/dashboard/page-b548fe2aac951e5b.js +1 -0
  183. package/.next/static/chunks/app/(main)/layout-9311354243420c0d.js +1 -0
  184. package/.next/static/chunks/app/(main)/players/page-706f5e796129df33.js +1 -0
  185. package/.next/static/chunks/app/(main)/routing/page-14f40cfd98e60a77.js +1 -0
  186. package/.next/static/chunks/app/(main)/servers/[name]/console/{page-b25581705b8b2277.js → page-ca0344337ef5da93.js} +1 -1
  187. package/.next/static/chunks/app/(main)/servers/[name]/page-55fee1f878b51fb8.js +1 -0
  188. package/.next/static/chunks/app/(main)/servers/page-efa5f11aa2956719.js +1 -0
  189. package/.next/static/chunks/app/(main)/worlds/page-3de10e94b77f6e45.js +1 -0
  190. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/login/page-39f136cf2697cefc.js → static/chunks/app/login/page-3ad9d595e6c37214.js} +1 -1
  191. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/signup/page-9c69da79dac7dff9.js → static/chunks/app/signup/page-69a8bc2df6bc3559.js} +1 -1
  192. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/main-34a19e4bc5b0f28c.js → static/chunks/main-43f98b458d773ca0.js} +1 -1
  193. package/.next/static/css/8dfdea5f9ccf5da4.css +1 -0
  194. package/package.json +2 -2
  195. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1277.js +0 -1
  196. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1990.js +0 -1
  197. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/2612.js +0 -51
  198. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3003.js +0 -52
  199. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5211.js +0 -1
  200. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7427.js +0 -1
  201. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/9374.js +0 -74
  202. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1044-6a0c0a7f6bac9f18.js +0 -1
  203. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1604-89bbfa231d141dfe.js +0 -1
  204. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1692-e2b4fd0b6bff20c2.js +0 -1
  205. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1826-ce6a4d6a0e4ba9bd.js +0 -1
  206. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1857-8bb2c9883e08cdee.js +0 -1
  207. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2537-a2a6d99925a2f67e.js +0 -1
  208. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2590-b868e035d36b0545.js +0 -1
  209. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2609-03ed3c8604060401.js +0 -1
  210. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/3418-6f5e8a8a4b7ab70c.js +0 -1
  211. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4136-c4b760387b52c47c.js +0 -1
  212. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4507-e0145a1cb67c26c3.js +0 -1
  213. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5375-5a2ae74444004be4.js +0 -1
  214. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5382-af8412c783dd977e.js +0 -1
  215. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6357-42a429de7d961f53.js +0 -1
  216. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6877-7a90baa4093abc8d.js +0 -1
  217. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7340-99d68f86a8108252.js +0 -1
  218. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8063-134a13770297c002.js +0 -1
  219. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8809-974009fa7800dfcd.js +0 -1
  220. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9409-171ee4b34553d85a.js +0 -1
  221. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/page-2755e6f9daa86325.js +0 -1
  222. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-2849792531fd0eac.js +0 -1
  223. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-2d0dc6a87f23e622.js +0 -1
  224. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-bbfb7b031b828115.js +0 -1
  225. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-36951c10705b7f9a.js +0 -1
  226. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/page-886b5fabf41e5c65.js +0 -1
  227. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-f04eb3d1fe4c68df.js +0 -1
  228. package/.next/standalone/platform/services/mcctl-console/.next/static/css/ce1ae78c22152744.css +0 -1
  229. package/.next/static/chunks/1044-6a0c0a7f6bac9f18.js +0 -1
  230. package/.next/static/chunks/1604-89bbfa231d141dfe.js +0 -1
  231. package/.next/static/chunks/1692-e2b4fd0b6bff20c2.js +0 -1
  232. package/.next/static/chunks/1826-ce6a4d6a0e4ba9bd.js +0 -1
  233. package/.next/static/chunks/1857-8bb2c9883e08cdee.js +0 -1
  234. package/.next/static/chunks/2537-a2a6d99925a2f67e.js +0 -1
  235. package/.next/static/chunks/2590-b868e035d36b0545.js +0 -1
  236. package/.next/static/chunks/2609-03ed3c8604060401.js +0 -1
  237. package/.next/static/chunks/3418-6f5e8a8a4b7ab70c.js +0 -1
  238. package/.next/static/chunks/4136-c4b760387b52c47c.js +0 -1
  239. package/.next/static/chunks/4507-e0145a1cb67c26c3.js +0 -1
  240. package/.next/static/chunks/5375-5a2ae74444004be4.js +0 -1
  241. package/.next/static/chunks/5382-af8412c783dd977e.js +0 -1
  242. package/.next/static/chunks/6357-42a429de7d961f53.js +0 -1
  243. package/.next/static/chunks/6877-7a90baa4093abc8d.js +0 -1
  244. package/.next/static/chunks/7340-99d68f86a8108252.js +0 -1
  245. package/.next/static/chunks/8063-134a13770297c002.js +0 -1
  246. package/.next/static/chunks/8809-974009fa7800dfcd.js +0 -1
  247. package/.next/static/chunks/9409-171ee4b34553d85a.js +0 -1
  248. package/.next/static/chunks/app/(main)/dashboard/page-2755e6f9daa86325.js +0 -1
  249. package/.next/static/chunks/app/(main)/layout-2849792531fd0eac.js +0 -1
  250. package/.next/static/chunks/app/(main)/players/page-2d0dc6a87f23e622.js +0 -1
  251. package/.next/static/chunks/app/(main)/routing/page-bbfb7b031b828115.js +0 -1
  252. package/.next/static/chunks/app/(main)/servers/[name]/page-36951c10705b7f9a.js +0 -1
  253. package/.next/static/chunks/app/(main)/servers/page-886b5fabf41e5c65.js +0 -1
  254. package/.next/static/chunks/app/(main)/worlds/page-f04eb3d1fe4c68df.js +0 -1
  255. package/.next/static/css/ce1ae78c22152744.css +0 -1
  256. /package/.next/standalone/platform/services/mcctl-console/.next/static/{Liy7QkeEpyjPtxhvsF9oz → 8BG9m6JnLqB8k8011EMcp}/_buildManifest.js +0 -0
  257. /package/.next/standalone/platform/services/mcctl-console/.next/static/{Liy7QkeEpyjPtxhvsF9oz → 8BG9m6JnLqB8k8011EMcp}/_ssgManifest.js +0 -0
  258. /package/.next/static/{Liy7QkeEpyjPtxhvsF9oz → 8BG9m6JnLqB8k8011EMcp}/_buildManifest.js +0 -0
  259. /package/.next/static/{Liy7QkeEpyjPtxhvsF9oz → 8BG9m6JnLqB8k8011EMcp}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4095],{16387:function(e,r,t){Promise.resolve().then(t.bind(t,6453))},6453:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return H}});var n=t(94655),a=t(35106),i=t(7281),s=t(74228),l=t(46725),o=t(56275),c=t(62108),d=t(79983),h=t(31317),x=t(78765),m=t(90158),u=t(58347),p=t(49954),f=t(17820),g=t(73424),b=t(61505),j=t(71185),y=t(76176),v=t(27171),Z=t(35847),w=t(29983),C=t(80620),k=t(84974),S=t(34675),P=t(85480),z=t(64779);function I(e){return(0,n.jsxs)(z.Z,{...e,viewBox:"0 0 32 32",children:[(0,n.jsx)("rect",{width:"32",height:"32",fill:"#5DA840"}),(0,n.jsx)("rect",{x:"4",y:"8",width:"8",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"20",y:"8",width:"8",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"12",y:"16",width:"8",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"8",y:"20",width:"16",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"8",y:"28",width:"4",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"20",y:"28",width:"4",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"8",y:"4",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"24",y:"0",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"28",y:"8",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"0",y:"24",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"})]})}var W=t(8690);let A=[{label:"Dashboard",href:"/dashboard",icon:(0,n.jsx)(y.Z,{})},{label:"Servers",href:"/servers",icon:(0,n.jsx)(v.Z,{})},{label:"Worlds",href:"/worlds",icon:(0,n.jsx)(k.Z,{})},{label:"Players",href:"/players",icon:(0,n.jsx)(Z.Z,{})},{label:"Audit Log",href:"/audit-logs",icon:(0,n.jsx)(C.Z,{})},{label:"Backups",href:"/backups",icon:(0,n.jsx)(S.Z,{})},{label:"Routing",href:"/routing",icon:(0,n.jsx)(w.Z,{})}];function D(e){let{mobileOpen:r,onMenuToggle:t}=e,a=(0,s.usePathname)(),y=e=>"/dashboard"===e?"/dashboard"===a||"/"===a:a.startsWith(e);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{position:"fixed",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider",zIndex:e=>e.zIndex.drawer+1},children:(0,n.jsxs)(c.Z,{sx:{maxWidth:"1400px",width:"100%",mx:"auto",px:{xs:2,sm:3}},children:[(0,n.jsx)(d.Z,{color:"inherit","aria-label":"open menu",edge:"start",onClick:t,sx:{mr:2,display:{md:"none"}},children:(0,n.jsx)(b.Z,{})}),(0,n.jsxs)(l.default,{href:"/",style:{textDecoration:"none",display:"flex",alignItems:"center"},children:[(0,n.jsx)(I,{sx:{fontSize:28,color:"primary.main",mr:1}}),(0,n.jsx)(h.Z,{variant:"h6",component:"span",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"common.white",letterSpacing:"0.05em",fontSize:"1.1rem"},children:"Minecraft Console"})]}),(0,n.jsx)(i.Z,{component:"nav",sx:{display:{xs:"none",md:"flex"},alignItems:"center",gap:1,ml:4,flex:1},children:A.map(e=>{let r=y(e.href);return(0,n.jsx)(l.default,{href:e.href,style:{textDecoration:"none"},onClick:()=>!r&&(0,W.Av)(),children:(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderRadius:2,color:r?"primary.main":"text.secondary",backgroundColor:r?"action.selected":"transparent",transition:"all 0.2s ease","&:hover":{backgroundColor:"action.hover",color:r?"primary.main":"text.primary"}},children:[(0,n.jsx)(i.Z,{component:"span",sx:{display:"flex",alignItems:"center","& svg":{fontSize:20}},children:e.icon}),(0,n.jsx)(h.Z,{variant:"body2",sx:{fontWeight:r?600:400},children:e.label})]})},e.href)})}),(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:(0,n.jsx)(P.Ie,{})})]})}),(0,n.jsx)(x.ZP,{variant:"temporary",anchor:"left",open:r,onClose:t,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:280,backgroundColor:"background.paper"}},children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:2,minHeight:64,borderBottom:"1px solid",borderColor:"divider"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,n.jsx)(I,{sx:{fontSize:24,color:"primary.main",mr:1}}),(0,n.jsx)(h.Z,{variant:"h6",component:"span",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"primary.main",letterSpacing:"0.05em",fontSize:"1rem"},children:"Minecraft Console"})]}),(0,n.jsx)(d.Z,{onClick:t,"aria-label":"close menu",children:(0,n.jsx)(j.Z,{})})]}),(0,n.jsx)(m.Z,{sx:{flex:1,px:1,py:2},children:A.map(e=>{let r=y(e.href);return(0,n.jsx)(u.ZP,{disablePadding:!0,sx:{mb:.5},children:(0,n.jsxs)(p.Z,{component:l.default,href:e.href,onClick:()=>{t(),r||(0,W.Av)()},"aria-current":r?"page":void 0,sx:{borderRadius:2,backgroundColor:r?"action.selected":"transparent","&:hover":{backgroundColor:"action.hover"}},children:[(0,n.jsx)(f.Z,{sx:{color:r?"primary.main":"text.secondary",minWidth:40},children:e.icon}),(0,n.jsx)(g.Z,{primary:e.label,primaryTypographyProps:{fontWeight:r?600:400,color:r?"primary.main":"text.primary"}})]})},e.href)})})]})})]})}var T=t(67337),_=t(41261),E=t(69123),L=t(75845),M=t(43880);function q(e){return(0,n.jsx)(z.Z,{...e,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.186m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288z"})})}let R=[{title:"Resources",links:[{label:"Getting Started",href:"https://minecraft-server-manager.readthedocs.io/en/latest/getting-started/",external:!0},{label:"Configuration",href:"https://minecraft-server-manager.readthedocs.io/en/latest/configuration/",external:!0},{label:"Troubleshooting",href:"https://minecraft-server-manager.readthedocs.io/en/latest/troubleshooting/",external:!0}]},{title:"Documentation",links:[{label:"CLI Commands",href:"https://minecraft-server-manager.readthedocs.io/en/latest/cli/",external:!0},{label:"API Reference",href:"https://minecraft-server-manager.readthedocs.io/en/latest/console/",external:!0},{label:"itzg Reference",href:"https://minecraft-server-manager.readthedocs.io/en/latest/itzg-reference/",external:!0}]},{title:"Community",links:[{label:"GitHub",href:"https://github.com/smallmiro/minecraft-server-manager",external:!0},{label:"Issues",href:"https://github.com/smallmiro/minecraft-server-manager/issues",external:!0}]},{title:"About",links:[{label:"License",href:"https://github.com/smallmiro/minecraft-server-manager/blob/main/LICENSE",external:!0},{label:"Docker Hub",href:"https://hub.docker.com/r/itzg/minecraft-server",external:!0}]}];function B(){let e=new Date().getFullYear();return(0,n.jsx)(i.Z,{component:"footer",sx:{backgroundColor:"background.paper",borderTop:"1px solid",borderColor:"divider",mt:"auto"},children:(0,n.jsxs)(T.Z,{maxWidth:"lg",sx:{py:6},children:[(0,n.jsx)(i.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(4, 1fr)"},gap:4,mb:4},children:R.map(e=>(0,n.jsxs)(i.Z,{children:[(0,n.jsx)(h.Z,{variant:"subtitle2",sx:{fontWeight:600,color:"text.primary",mb:2},children:e.title}),(0,n.jsx)(i.Z,{component:"ul",sx:{listStyle:"none",p:0,m:0},children:e.links.map(e=>(0,n.jsx)(i.Z,{component:"li",sx:{mb:1},children:(0,n.jsx)(_.Z,{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,underline:"hover",sx:{color:"text.secondary",fontSize:"0.875rem",transition:"color 0.2s ease","&:hover":{color:"primary.main"}},children:e.label})},e.label))})]},e.title))}),(0,n.jsx)(E.Z,{sx:{mb:3}}),(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},gap:2},children:[(0,n.jsxs)(h.Z,{variant:"body2",sx:{color:"text.tertiary"},children:[e," \xa9"," ",(0,n.jsx)(_.Z,{href:"https://github.com/smallmiro/minecraft-server-manager",target:"_blank",rel:"noopener noreferrer",underline:"hover",sx:{color:"primary.main"},children:"Minecraft Server Management Console"})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",gap:2},children:[(0,n.jsx)(_.Z,{href:"https://github.com/smallmiro/minecraft-server-manager",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(L.Z,{fontSize:"small"})}),(0,n.jsx)(_.Z,{href:"https://minecraft-server-manager.readthedocs.io/",target:"_blank",rel:"noopener noreferrer","aria-label":"Documentation",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(M.Z,{fontSize:"small"})}),(0,n.jsx)(_.Z,{href:"https://hub.docker.com/r/itzg/minecraft-server",target:"_blank",rel:"noopener noreferrer","aria-label":"Docker Hub",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(q,{fontSize:"small"})})]})]})]})})}function H(e){let{children:r}=e,[t,s]=(0,a.useState)(!1);return(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",backgroundColor:"background.default"},children:[(0,n.jsx)(D,{mobileOpen:t,onMenuToggle:()=>{s(!t)}}),(0,n.jsx)(i.Z,{component:"main",sx:{flexGrow:1,display:"flex",flexDirection:"column",pt:{xs:"".concat(88,"px"),sm:"".concat(96,"px")},pb:{xs:3,sm:4},px:{xs:2,sm:3,md:4},maxWidth:"1400px",width:"100%",mx:"auto"},children:r}),(0,n.jsx)(B,{})]})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return u},WS:function(){return p},Ie:function(){return P}});var n=t(94655),a=t(35106),i=t(7281),s=t(81071),l=t(97436),o=t(52082),c=t(79983),d=t(30417),h=t(36848),x=t(554),m=t(6986);function u(e){let{onSuccess:r}=e,[t,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[g,b]=(0,a.useState)(!1),[j,y]=(0,a.useState)({}),[v,Z]=(0,a.useState)(null),[w,C]=(0,a.useState)(!1),k=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),y(e),0===Object.keys(e).length},S=async e=>{if(e.preventDefault(),Z(null),k()){C(!0);try{let e=await m.zB.email({email:t,password:p});if(e.error){Z(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){Z("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(i.Z,{component:"form",onSubmit:S,sx:{display:"flex",flexDirection:"column",gap:2},children:[v&&(0,n.jsx)(s.Z,{severity:"error",onClose:()=>Z(null),children:v}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>u(e.target.value),error:!!j.email,helperText:j.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!j.password,helperText:j.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!g)},edge:"end",children:g?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(d.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[g,b]=(0,a.useState)(""),[j,y]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[k,S]=(0,a.useState)({}),[P,z]=(0,a.useState)(null),[I,W]=(0,a.useState)(!1),A=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",j?g!==j&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",S(e),0===Object.keys(e).length},D=async e=>{if(e.preventDefault(),z(null),A()){W(!0);try{let e=await m.y1.email({email:p,password:g,name:t});if(e.error){z(e.error.message||"Registration failed"),W(!1);return}r&&r()}catch(e){z("An unexpected error occurred. Please try again."),W(!1)}}};return(0,n.jsxs)(i.Z,{component:"form",onSubmit:D,sx:{display:"flex",flexDirection:"column",gap:2},children:[P&&(0,n.jsx)(s.Z,{severity:"error",onClose:()=>z(null),children:P}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>u(e.target.value),error:!!k.name,helperText:k.name,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!k.email,helperText:k.email,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:v?"text":"password",value:g,onChange:e=>b(e.target.value),error:!!k.password,helperText:k.password,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!v)},edge:"end",children:v?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:j,onChange:e=>y(e.target.value),error:!!k.confirmPassword,helperText:k.confirmPassword,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(d.Z,{type:"submit",variant:"contained",color:"primary",disabled:I,fullWidth:!0,size:"large",children:I?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),b=t(86702),j=t(35694),y=t(31317),v=t(25333),Z=t(69123),w=t(7178),C=t(17820),k=t(73424),S=t(78319);function P(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,m.kP)(),[s,l]=(0,a.useState)(null),o=()=>{l(null)},h=async()=>{o(),await (0,m.w7)(),e.push("/login")};if(t)return(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(d.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:x}=r,u=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(x.name,x.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(b.Z,{sx:{bgcolor:"primary.main"},children:u})}),(0,n.jsxs)(j.Z,{anchorEl:s,open:!!s,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(i.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(y.Z,{variant:"subtitle1",fontWeight:"600",children:x.name||"User"}),(0,n.jsx)(y.Z,{variant:"body2",color:"text.secondary",children:x.email}),"admin"===x.role&&(0,n.jsx)(v.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(w.Z,{onClick:h,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(S.Z,{fontSize:"small"})}),(0,n.jsx)(k.Z,{children:"Logout"})]})]})]})}},3454:function(e,r,t){"use strict";t.d(r,{LoadingProvider:function(){return o},startLoading:function(){return c},stopLoading:function(){return d}});var n=t(94655),a=t(35106),i=t(74228),s=t(31477),l=t.n(s);function o(e){let{children:r}=e,t=(0,i.usePathname)(),s=(0,i.useSearchParams)();return(0,a.useEffect)(()=>{l().done()},[t,s]),(0,n.jsx)(n.Fragment,{children:r})}function c(){l().start()}function d(){l().done()}l().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,r,t){"use strict";t.d(r,{Av:function(){return n.startLoading}});var n=t(3454)},6986:function(e,r,t){"use strict";t.d(r,{kP:function(){return c},w7:function(){return l},y1:function(){return o},zB:function(){return s}});var n=t(77054),a=t(61648),i=t(35016);let{signIn:s,signOut:l,signUp:o,useSession:c}=(0,n.X)({baseURL:i.env.NEXT_PUBLIC_BETTER_AUTH_URL||"http://localhost:5000",plugins:[(0,a.zB)()]})}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,55,3543,8347,2149,2542,8322,8918,212,3669,2757,1744],function(){return e(e.s=16387)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[781],{31809:function(e,r,n){Promise.resolve().then(n.bind(n,83785))},83785:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return X}});var t=n(94655),a=n(35106),s=n(7281),i=n(31317),o=n(84840),l=n(33402),c=n(60097),d=n(29793),u=n(75726),y=n(62328),h=n(7178),p=n(69899),x=n(76492),m=n(35847),j=n(628),f=n(41565),v=n(90158),Z=n(58347),b=n(73424),g=n(69783),C=n(86702),S=n(79983),w=n(30417),k=n(25333),E=n(99770),F=n(62508),I=n(5682),q=n(65087),P=n(76678),N=n(97436),K=n(93017),O=n(81071),R=n(66561),T=n(12795),U=n(96407),L=n(69366),D=n(11597),Q=n(81960),A=n(30114);function B(e){let{onPlayerKicked:r}=e,[n,o]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[y,h]=(0,a.useState)(!1),[p,x]=(0,a.useState)(null),[m,B]=(0,a.useState)(""),[W,z]=(0,a.useState)(!1),J=(0,a.useCallback)(async()=>{o(!0),c(null);try{let e=await fetch("/api/players");if(!e.ok)throw Error("Failed to fetch players");let r=await e.json();u(r.servers)}catch(e){c("Failed to load players"),console.error("Error fetching players:",e)}finally{o(!1)}},[]);(0,a.useEffect)(()=>{J()},[J]);let _=(e,r)=>{x({player:e,server:r}),B(""),h(!0)},M=async()=>{if(p){z(!0);try{if(!(await fetch("/api/players/kick",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:p.player.name,server:p.server,reason:m||"Kicked by administrator"})})).ok)throw Error("Failed to kick player");h(!1),x(null),null==r||r(p.player,p.server),await J()}catch(e){console.error("Error kicking player:",e)}finally{z(!1)}}},H=d.some(e=>e.players.length>0);return(0,t.jsx)(j.Z,{"data-testid":"player-list",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(i.Z,{variant:"h6",children:"Online Players"}),(0,t.jsx)(S.Z,{onClick:J,disabled:n,"aria-label":"Refresh",children:(0,t.jsx)(L.Z,{})})]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(K.Z,{})}),l&&(0,t.jsx)(O.Z,{severity:"error",sx:{mb:2},children:l}),!n&&!l&&!H&&(0,t.jsx)(i.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players online"}),!n&&!l&&H&&(0,t.jsx)(s.Z,{children:d.map(e=>(0,t.jsxs)(R.Z,{defaultExpanded:e.players.length>0,children:[(0,t.jsx)(T.Z,{expandIcon:(0,t.jsx)(Q.Z,{}),children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:2,width:"100%"},children:[(0,t.jsx)(i.Z,{variant:"subtitle1",sx:{fontWeight:500},children:e.name}),(0,t.jsx)(k.Z,{label:"".concat(e.players.length," player").concat(1!==e.players.length?"s":""),size:"small",color:e.players.length>0?"success":"default"})]})}),(0,t.jsx)(U.Z,{children:0===e.players.length?(0,t.jsx)(i.Z,{color:"text.secondary",sx:{fontStyle:"italic"},children:"No players online on this server"}):(0,t.jsx)(v.Z,{dense:!0,children:e.players.map(r=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(S.Z,{edge:"end","aria-label":"Kick player",onClick:()=>_(r,e.name),color:"error",children:(0,t.jsx)(D.Z,{})}),children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(C.Z,{src:"https://mc-heads.net/avatar/".concat(r.uuid,"/40"),alt:r.name,children:(0,t.jsx)(A.Z,{})})}),(0,t.jsx)(b.Z,{primary:r.name,secondary:r.uuid.substring(0,8)+"..."})]},r.uuid))})})]},e.name))}),(0,t.jsxs)(E.Z,{open:y,onClose:()=>h(!1),children:[(0,t.jsx)(F.Z,{children:"Kick Player"}),(0,t.jsxs)(I.Z,{children:[(0,t.jsxs)(q.Z,{children:["Are you sure you want to kick ",null==p?void 0:p.player.name," from ",null==p?void 0:p.server,"?"]}),(0,t.jsx)(N.Z,{autoFocus:!0,margin:"dense",label:"Reason (optional)",fullWidth:!0,variant:"outlined",value:m,onChange:e=>B(e.target.value),placeholder:"Kicked by administrator"})]}),(0,t.jsxs)(P.Z,{children:[(0,t.jsx)(w.Z,{onClick:()=>h(!1),disabled:W,children:"Cancel"}),(0,t.jsx)(w.Z,{onClick:M,color:"error",variant:"contained",disabled:W,"aria-label":"Confirm kick",children:W?(0,t.jsx)(K.Z,{size:20}):"Confirm"})]})]})]})})}var W=n(70115),z=n(21111),J=n(47606);function _(e){let{serverName:r}=e,[n,o]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[y,h]=(0,a.useState)(""),[p,x]=(0,a.useState)(!1),[m,k]=(0,a.useState)(null),E=(0,a.useCallback)(async()=>{o(!0),c(null);try{let e=await fetch("/api/players/whitelist?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch whitelist");let n=await e.json();u(n.players)}catch(e){c("Failed to load whitelist"),console.error("Error fetching whitelist:",e)}finally{o(!1)}},[r]);(0,a.useEffect)(()=>{E()},[E]);let F=async()=>{if(y.trim()){x(!0),c(null);try{if(!(await fetch("/api/players/whitelist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:y.trim(),server:r})})).ok)throw Error("Failed to add player");h(""),await E()}catch(e){c("Failed to add player to whitelist"),console.error("Error adding player:",e)}finally{x(!1)}}},I=async e=>{k(e),c(null);try{if(!(await fetch("/api/players/whitelist?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to remove player");await E()}catch(e){c("Failed to remove player from whitelist"),console.error("Error removing player:",e)}finally{k(null)}};return(0,t.jsx)(j.Z,{"data-testid":"whitelist-manager",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Whitelist"}),l&&(0,t.jsx)(O.Z,{severity:"error",sx:{mb:2},children:l}),(0,t.jsxs)(W.Z,{direction:"row",spacing:1,sx:{mb:2},children:[(0,t.jsx)(N.Z,{size:"small",placeholder:"Player name",value:y,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&F()},disabled:p,fullWidth:!0}),(0,t.jsx)(w.Z,{variant:"contained",onClick:F,disabled:!y.trim()||p,startIcon:p?(0,t.jsx)(K.Z,{size:16}):(0,t.jsx)(J.Z,{}),"aria-label":"Add player to whitelist",children:"Add"})]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(K.Z,{})}),!n&&0===d.length&&(0,t.jsx)(i.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players whitelisted"}),!n&&d.length>0&&(0,t.jsx)(v.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(S.Z,{edge:"end","aria-label":"Remove from whitelist",onClick:()=>I(e.name),disabled:m===e.name,color:"error",children:m===e.name?(0,t.jsx)(K.Z,{size:20}):(0,t.jsx)(z.Z,{})}),children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,children:(0,t.jsx)(A.Z,{})})}),(0,t.jsx)(b.Z,{primary:e.name,secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))})]})})}var M=n(407);function H(e){let{serverName:r}=e,[n,o]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[y,h]=(0,a.useState)(""),[p,x]=(0,a.useState)(!1),[m,E]=(0,a.useState)(null),F=(0,a.useCallback)(async()=>{o(!0),c(null);try{let e=await fetch("/api/players/op?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch operators");let n=await e.json();u(n.operators)}catch(e){c("Failed to load operators"),console.error("Error fetching operators:",e)}finally{o(!1)}},[r]);(0,a.useEffect)(()=>{F()},[F]);let I=async()=>{if(y.trim()){x(!0),c(null);try{if(!(await fetch("/api/players/op",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:y.trim(),server:r})})).ok)throw Error("Failed to add operator");h(""),await F()}catch(e){c("Failed to add operator"),console.error("Error adding operator:",e)}finally{x(!1)}}},q=async e=>{E(e),c(null);try{if(!(await fetch("/api/players/op?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to remove operator");await F()}catch(e){c("Failed to remove operator"),console.error("Error removing operator:",e)}finally{E(null)}},P=e=>{switch(e){case 4:return"error";case 3:return"secondary";case 2:return"primary";default:return"default"}};return(0,t.jsx)(j.Z,{"data-testid":"op-manager",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Operators"}),l&&(0,t.jsx)(O.Z,{severity:"error",sx:{mb:2},children:l}),(0,t.jsxs)(W.Z,{direction:"row",spacing:1,sx:{mb:2},children:[(0,t.jsx)(N.Z,{size:"small",placeholder:"Player name",value:y,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&I()},disabled:p,fullWidth:!0}),(0,t.jsx)(w.Z,{variant:"contained",onClick:I,disabled:!y.trim()||p,startIcon:p?(0,t.jsx)(K.Z,{size:16}):(0,t.jsx)(J.Z,{}),"aria-label":"Add operator",children:"Add"})]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(K.Z,{})}),!n&&0===d.length&&(0,t.jsx)(i.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No operators configured"}),!n&&d.length>0&&(0,t.jsx)(v.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(S.Z,{edge:"end","aria-label":"Remove operator",onClick:()=>q(e.name),disabled:m===e.name,color:"error",children:m===e.name?(0,t.jsx)(K.Z,{size:20}):(0,t.jsx)(z.Z,{})}),children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"warning.main"},children:(0,t.jsx)(M.Z,{})})}),(0,t.jsx)(b.Z,{primary:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.name,(0,t.jsx)(k.Z,{label:"Level ".concat(e.level),size:"small",color:P(e.level)})]}),secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))})]})})}var $=n(397);function Y(e){let{serverName:r}=e,[n,o]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[y,h]=(0,a.useState)(!1),[p,x]=(0,a.useState)({player:"",reason:""}),[m,k]=(0,a.useState)(!1),[q,R]=(0,a.useState)(null),T=(0,a.useCallback)(async()=>{o(!0),c(null);try{let e=await fetch("/api/players/ban?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch bans");let n=await e.json();u(n.players)}catch(e){c("Failed to load ban list"),console.error("Error fetching bans:",e)}finally{o(!1)}},[r]);(0,a.useEffect)(()=>{T()},[T]);let U=()=>{h(!1),x({player:"",reason:""})},L=async()=>{if(p.player.trim()){k(!0),c(null);try{if(!(await fetch("/api/players/ban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:p.player.trim(),reason:p.reason.trim()||"Banned by administrator",server:r})})).ok)throw Error("Failed to ban player");U(),await T()}catch(e){c("Failed to ban player"),console.error("Error banning player:",e)}finally{k(!1)}}},D=async e=>{R(e),c(null);try{if(!(await fetch("/api/players/ban?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to unban player");await T()}catch(e){c("Failed to unban player"),console.error("Error unbanning player:",e)}finally{R(null)}},Q=e=>{try{return new Date(e).toLocaleDateString()}catch(r){return e}};return(0,t.jsx)(j.Z,{"data-testid":"ban-manager",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(i.Z,{variant:"h6",children:"Ban List"}),(0,t.jsx)(w.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)($.Z,{}),onClick:()=>{x({player:"",reason:""}),h(!0)},"aria-label":"Ban player",children:"Ban Player"})]}),l&&(0,t.jsx)(O.Z,{severity:"error",sx:{mb:2},children:l}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(K.Z,{})}),!n&&0===d.length&&(0,t.jsx)(i.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players banned"}),!n&&d.length>0&&(0,t.jsx)(v.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(S.Z,{edge:"end","aria-label":"Unban player",onClick:()=>D(e.name),disabled:q===e.name,color:"success",children:q===e.name?(0,t.jsx)(K.Z,{size:20}):(0,t.jsx)(z.Z,{})}),children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"error.main"},children:(0,t.jsx)(A.Z,{})})}),(0,t.jsx)(b.Z,{primary:e.name,secondary:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(i.Z,{component:"span",variant:"body2",color:"text.secondary",children:["Reason: ",e.reason||"No reason specified"]}),(0,t.jsx)("br",{}),(0,t.jsxs)(i.Z,{component:"span",variant:"caption",color:"text.secondary",children:["Banned: ",Q(e.created)," by ",e.source||"Unknown"]})]})})]},e.uuid||e.name))}),(0,t.jsxs)(E.Z,{open:y,onClose:U,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(F.Z,{children:"Ban Player"}),(0,t.jsx)(I.Z,{children:(0,t.jsxs)(W.Z,{spacing:2,sx:{mt:1},children:[(0,t.jsx)(N.Z,{label:"Player Name",placeholder:"Enter player name",value:p.player,onChange:e=>x({...p,player:e.target.value}),fullWidth:!0,required:!0}),(0,t.jsx)(N.Z,{label:"Reason",placeholder:"Banned by administrator",value:p.reason,onChange:e=>x({...p,reason:e.target.value}),fullWidth:!0,multiline:!0,rows:2})]})}),(0,t.jsxs)(P.Z,{children:[(0,t.jsx)(w.Z,{onClick:U,disabled:m,children:"Cancel"}),(0,t.jsx)(w.Z,{onClick:L,color:"error",variant:"contained",disabled:!p.player.trim()||m,startIcon:m?(0,t.jsx)(K.Z,{size:16}):(0,t.jsx)($.Z,{}),children:"Ban"})]})]})]})})}var G=n(92666);function V(e){let{children:r,value:n,index:a}=e;return(0,t.jsx)("div",{role:"tabpanel",hidden:n!==a,children:n===a&&(0,t.jsx)(s.Z,{sx:{py:3},children:r})})}function X(){let[e,r]=(0,a.useState)(0),[n,j]=(0,a.useState)(""),{data:f,isLoading:v}=(0,G.x$)(),Z=null==f?void 0:f.servers;return(0,a.useEffect)(()=>{!n&&Z&&Z.length>0&&j(Z[0].name)},[Z,n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,x.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,x.Fq)(e.palette.secondary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,x.Fq)(e.palette.info.main,.2))},children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,t.jsx)(m.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(i.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Player Management"}),(0,t.jsx)(i.Z,{variant:"body1",color:"text.secondary",children:"Manage players, whitelist, operators, and bans across your servers"})]})]})}),(0,t.jsx)(s.Z,{sx:{mb:3},children:(0,t.jsxs)(d.Z,{sx:{minWidth:200},children:[(0,t.jsx)(u.Z,{id:"server-select-label",children:"Server"}),(0,t.jsx)(y.Z,{labelId:"server-select-label",value:n,label:"Server",onChange:e=>j(e.target.value),disabled:v,children:null==Z?void 0:Z.map(e=>(0,t.jsx)(h.Z,{value:e.name,children:e.name},e.name))})]})}),(0,t.jsx)(s.Z,{sx:{borderBottom:1,borderColor:"divider"},children:(0,t.jsxs)(l.Z,{value:e,onChange:(e,n)=>{r(n)},"aria-label":"Player management tabs",children:[(0,t.jsx)(c.Z,{label:"Online Players"}),(0,t.jsx)(c.Z,{label:"Whitelist",disabled:!n}),(0,t.jsx)(c.Z,{label:"Operators",disabled:!n}),(0,t.jsx)(c.Z,{label:"Ban List",disabled:!n})]})}),(0,t.jsx)(V,{value:e,index:0,children:(0,t.jsx)(B,{})}),(0,t.jsx)(V,{value:e,index:1,children:n&&(0,t.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(o.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(_,{serverName:n})}),(0,t.jsx)(o.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Whitelist"}),(0,t.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"The whitelist controls which players can join your server. When enabled, only players on the whitelist can connect. Add players by their Minecraft username."})]})})]})}),(0,t.jsx)(V,{value:e,index:2,children:n&&(0,t.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(o.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(H,{serverName:n})}),(0,t.jsx)(o.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Operators"}),(0,t.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"Operators (OPs) have elevated permissions on the server. They can use commands like /give, /gamemode, /tp, and more. OP levels range from 1-4, with 4 being the highest."}),(0,t.jsxs)(s.Z,{sx:{mt:2},children:[(0,t.jsx)(i.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 1: Can bypass spawn protection"}),(0,t.jsx)(i.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 2: Can use /clear, /gamemode, etc."}),(0,t.jsx)(i.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 3: Can use /ban, /kick, /op, etc."}),(0,t.jsx)(i.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 4: Can use /stop, full access"})]})]})})]})}),(0,t.jsx)(V,{value:e,index:3,children:n&&(0,t.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(o.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(Y,{serverName:n})}),(0,t.jsx)(o.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Bans"}),(0,t.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"Banned players cannot connect to your server. You can ban players by username and provide an optional reason. Bans can be removed (pardoned) at any time."})]})})]})})]})}},42936:function(e,r,n){"use strict";async function t(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...r.headers};r.body&&(n["Content-Type"]="application/json");let t=await fetch(e,{...r,headers:n});if(!t.ok){let e=await t.json().catch(()=>({error:"UnknownError",message:t.statusText})),r=Error(e.message);throw r.statusCode=t.status,r.code=e.error,r}return t.json()}n.d(r,{SC:function(){return t}})},92666:function(e,r,n){"use strict";n.d(r,{$t:function(){return C},Aw:function(){return u},Fv:function(){return j},Hq:function(){return c},Hy:function(){return l},MH:function(){return v},Sr:function(){return h},_I:function(){return y},c5:function(){return S},g2:function(){return m},gx:function(){return Z},hy:function(){return p},iC:function(){return f},jM:function(){return d},mj:function(){return g},nq:function(){return x},nv:function(){return b},s8:function(){return w},x$:function(){return o}});var t=n(5632),a=n(58919),s=n(20367),i=n(42936);function o(){return(0,t.a)({queryKey:["servers"],queryFn:()=>(0,i.SC)("/api/servers"),refetchInterval:6e4})}function l(e,r){return(0,t.a)({queryKey:["servers",e],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==r?void 0:r.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{name:r,force:n}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(r)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function d(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function u(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function y(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function h(){return(0,t.a)({queryKey:["worlds"],queryFn:()=>(0,i.SC)("/api/worlds"),refetchInterval:3e4})}function p(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function x(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:r,serverName:n}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(r),"/assign"),{method:"POST",body:JSON.stringify({serverName:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function m(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:r,force:n}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(r),"/release").concat(n?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function j(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{name:r,force:n}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(r)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(e,r){return(0,t.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function v(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{serverName:r,config:n}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(r),"/config"),{method:"PATCH",body:JSON.stringify(n)})},onSuccess:(r,n)=>{let{serverName:t}=n;e.invalidateQueries({queryKey:["servers",t,"config"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function Z(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers",n]}),e.invalidateQueries({queryKey:["worlds"]})}})}function b(){return(0,t.a)({queryKey:["router-status"],queryFn:()=>(0,i.SC)("/api/router/status"),refetchInterval:3e4})}function g(){return(0,t.a)({queryKey:["backup-status"],queryFn:()=>(0,i.SC)("/api/backup"),refetchInterval:6e4})}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,t.a)({queryKey:["backup-history",e],queryFn:()=>(0,i.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function S(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{message:r}=e;return(0,i.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function w(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,i.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,540,6189,4840,310,8347,2149,2022,8657,2093,3669,2757,1744],function(){return e(e.s=31809)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{61943:function(e,n,r){Promise.resolve().then(r.bind(r,73046))},73046:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return E}});var t=r(94655),s=r(7281),i=r(84840),o=r(31317),a=r(10721),c=r(81071),l=r(628),u=r(41565),d=r(69899),x=r(76492),h=r(29983),f=r(92666),m=r(25333),p=r(21138),y=r(84811),j=r(70366),v=r(47001),Z=r(59602);let g={fontWeight:500,color:"text.secondary",border:0,width:"40%",py:1},b={border:0,py:1};function w(e){var n;let{router:r}=e,i=(n=r.mode)?n.includes("in-docker")||n.includes("auto-discovery")?{label:"Auto Discovery",color:"info"}:n.includes("mapping")?{label:"Manual Mapping",color:"warning"}:{label:n,color:"default"}:{label:"Unknown",color:"default"};return(0,t.jsx)(l.Z,{children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(Z.Z,{color:"primary"}),(0,t.jsx)(o.Z,{variant:"h6",component:"h2",children:"Platform Information"})]}),(0,t.jsx)(p.Z,{size:"small",children:(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:g,children:"Router Name"}),(0,t.jsx)(v.Z,{sx:b,children:r.name})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:g,children:"Port"}),(0,t.jsx)(v.Z,{sx:b,children:r.port})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:g,children:"Mode"}),(0,t.jsx)(v.Z,{sx:b,children:(0,t.jsx)(m.Z,{label:i.label,size:"small",color:i.color,variant:"outlined"})})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:g,children:"Uptime"}),(0,t.jsx)(v.Z,{sx:b,children:r.uptime||"-"})]})]})})]})})}var S=r(95511),C=r(66561),q=r(12795),I=r(96407),K=r(81960);function F(e){switch(e){case"running":return"#4caf50";case"exited":case"dead":case"not_found":case"not_created":return"#f44336";case"created":case"restarting":case"paused":return"#ff9800";default:return"#9e9e9e"}}function N(e){let{status:n}=e;return(0,t.jsx)(S.Z,{title:n,arrow:!0,children:(0,t.jsx)(s.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:F(n),flexShrink:0,boxShadow:"running"===n?"0 0 6px ".concat(F(n)):"none"}})})}function k(e){let{router:n}=e,r=function(e){let n=new Map;for(let r of e){let e=r.target.replace(/^mc-/,"").replace(/:25565$/,""),t=n.get(e);t?t.hostnames.push(r.hostname):n.set(e,{status:r.serverStatus,hostnames:[r.hostname],serverType:r.serverType,serverVersion:r.serverVersion})}return n}(n.routes);return(0,t.jsx)(l.Z,{sx:{height:"100%"},children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(h.Z,{color:"primary"}),(0,t.jsx)(o.Z,{variant:"h6",component:"h2",children:"MC-Router Status"}),(0,t.jsxs)(s.Z,{sx:{ml:"auto",display:"flex",gap:1},children:[(0,t.jsx)(m.Z,{label:n.status,size:"small",color:function(e){switch(e){case"running":return"success";case"exited":case"dead":case"not_found":case"not_created":return"error";case"created":case"restarting":case"paused":return"warning";default:return"default"}}(n.status)}),(0,t.jsx)(m.Z,{label:n.health,size:"small",color:function(e){switch(e){case"healthy":return"success";case"unhealthy":return"error";case"starting":return"warning";default:return"default"}}(n.health),variant:"outlined"})]})]}),(0,t.jsx)(o.Z,{variant:"subtitle2",sx:{mb:1,mt:3},children:"Routing Table"}),0===n.routes.length?(0,t.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{py:2,textAlign:"center"},children:"No routes configured"}):(0,t.jsx)(s.Z,{sx:{mt:1},children:Array.from(r.entries()).map(e=>{let[n,{status:r,hostnames:i,serverType:a,serverVersion:c}]=e;return(0,t.jsxs)(C.Z,{defaultExpanded:!0,disableGutters:!0,elevation:0,sx:{border:1,borderColor:"divider","&:not(:last-child)":{borderBottom:0},"&::before":{display:"none"}},children:[(0,t.jsx)(q.Z,{expandIcon:(0,t.jsx)(K.Z,{}),children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",pr:1},children:[(0,t.jsx)(N,{status:r}),(0,t.jsx)(o.Z,{variant:"subtitle2",sx:{fontWeight:600},children:n}),(a||c)&&(0,t.jsx)(o.Z,{variant:"caption",color:"text.secondary",children:[a,c].filter(Boolean).join(" ")}),(0,t.jsxs)(o.Z,{variant:"caption",color:"text.secondary",sx:{ml:"auto"},children:[i.length," ",1===i.length?"route":"routes"]})]})}),(0,t.jsx)(I.Z,{sx:{pt:0},children:(0,t.jsx)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:.5},children:i.map(e=>(0,t.jsx)(o.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.85rem",color:"text.secondary"},children:e},e))})})]},n)})})]})})}var D=r(21605);let R={fontWeight:500,color:"text.secondary",border:0,width:"40%",py:1},P={border:0,py:1};function Q(e){var n;let{router:r}=e,i=r.routes.filter(e=>"running"===e.serverStatus).length,a=r.routes.length;return(0,t.jsx)(l.Z,{children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(D.Z,{color:"primary"}),(0,t.jsx)(o.Z,{variant:"h6",component:"h2",children:"Network Settings"})]}),(0,t.jsx)(p.Z,{size:"small",children:(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:R,children:"Listening Port"}),(0,t.jsx)(v.Z,{sx:P,children:(0,t.jsx)(m.Z,{label:r.port,size:"small",variant:"outlined"})})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:R,children:"Routing Mode"}),(0,t.jsx)(v.Z,{sx:P,children:(0,t.jsx)(m.Z,{label:(n=r.mode)?n.includes("in-docker")||n.includes("auto-discovery")?"Auto Discovery":n.includes("mapping")?"Manual Mapping":n:"Unknown",size:"small",color:"info",variant:"outlined"})})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:R,children:"Total Routes"}),(0,t.jsx)(v.Z,{sx:P,children:a})]}),(0,t.jsxs)(j.Z,{children:[(0,t.jsx)(v.Z,{sx:R,children:"Active Routes"}),(0,t.jsx)(v.Z,{sx:P,children:(0,t.jsx)(m.Z,{label:"".concat(i," / ").concat(a),size:"small",color:i>0?"success":"default",variant:"outlined"})})]})]})})]})})}var T=r(76544);function O(e){var n;let{avahi:r}=e,i=null!==(n=null==r?void 0:r.status)&&void 0!==n?n:"unknown";return(0,t.jsx)(l.Z,{children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(T.Z,{color:"primary"}),(0,t.jsx)(o.Z,{variant:"h6",component:"h2",children:"mDNS (Avahi)"}),(0,t.jsx)(m.Z,{label:i,size:"small",color:"running"===i?"success":i.includes("not running")?"warning":"not installed"===i?"error":"default",sx:{ml:"auto"}})]}),(0,t.jsxs)(o.Z,{variant:"body2",color:"text.secondary",children:["Avahi mDNS daemon enables ",(0,t.jsx)("code",{children:".local"})," hostname resolution for Minecraft servers on the local network."]})]})})}function L(e){let{rows:n}=e;return(0,t.jsx)(l.Z,{children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,t.jsx)(a.Z,{variant:"text",width:"50%",height:32})]}),[...Array(n)].map((e,n)=>(0,t.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",py:.75},children:[(0,t.jsx)(a.Z,{variant:"text",width:"35%"}),(0,t.jsx)(a.Z,{variant:"text",width:"40%"})]},n))]})})}function U(){return(0,t.jsx)(l.Z,{sx:{height:"100%"},children:(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,t.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,t.jsx)(a.Z,{variant:"text",width:"40%",height:32}),(0,t.jsxs)(s.Z,{sx:{ml:"auto",display:"flex",gap:1},children:[(0,t.jsx)(a.Z,{variant:"rounded",width:70,height:24}),(0,t.jsx)(a.Z,{variant:"rounded",width:70,height:24})]})]}),(0,t.jsx)(a.Z,{variant:"text",width:"30%",sx:{mt:3,mb:1}}),[0,1].map(e=>(0,t.jsxs)(s.Z,{sx:{border:1,borderColor:"divider",p:2,"&:not(:last-child)":{borderBottom:0}},children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,t.jsx)(a.Z,{variant:"circular",width:10,height:10}),(0,t.jsx)(a.Z,{variant:"text",width:"25%"}),(0,t.jsx)(a.Z,{variant:"text",width:"15%"}),(0,t.jsx)(a.Z,{variant:"text",width:"10%",sx:{ml:"auto"}})]}),[0,1,2].map(e=>(0,t.jsx)(a.Z,{variant:"text",width:"70%",sx:{ml:2.5}},e))]},e))]})})}function E(){let{data:e,isLoading:n,error:r}=(0,f.nv)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,x.Fq)(e.palette.warning.main,.1)," 0%, ").concat((0,x.Fq)(e.palette.info.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,x.Fq)(e.palette.warning.main,.2))},children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"warning.main",color:"warning.contrastText"},children:(0,t.jsx)(h.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Routing"}),(0,t.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Server routing and network configuration"})]})]})}),r&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load router status: ",r.message]}),n?(0,t.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,t.jsx)(L,{rows:4}),(0,t.jsx)(L,{rows:4}),(0,t.jsx)(L,{rows:1})]})}),(0,t.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(U,{})})]}):(null==e?void 0:e.router)?(0,t.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,t.jsx)(w,{router:e.router}),(0,t.jsx)(Q,{router:e.router}),(0,t.jsx)(O,{avahi:e.avahi})]})}),(0,t.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(k,{router:e.router})})]}):null]})}},42936:function(e,n,r){"use strict";async function t(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={...n.headers};n.body&&(r["Content-Type"]="application/json");let t=await fetch(e,{...n,headers:r});if(!t.ok){let e=await t.json().catch(()=>({error:"UnknownError",message:t.statusText})),n=Error(e.message);throw n.statusCode=t.status,n.code=e.error,n}return t.json()}r.d(n,{SC:function(){return t}})},92666:function(e,n,r){"use strict";r.d(n,{$t:function(){return w},Aw:function(){return d},Fv:function(){return y},Hq:function(){return l},Hy:function(){return c},MH:function(){return v},Sr:function(){return h},_I:function(){return x},c5:function(){return S},g2:function(){return p},gx:function(){return Z},hy:function(){return f},iC:function(){return j},jM:function(){return u},mj:function(){return b},nq:function(){return m},nv:function(){return g},s8:function(){return C},x$:function(){return a}});var t=r(5632),s=r(58919),i=r(20367),o=r(42936);function a(){return(0,t.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function c(e,n){return(0,t.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function l(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:r}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function u(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function d(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function x(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function h(){return(0,t.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function f(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function m(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,serverName:r}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function p(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,force:r}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(r?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function y(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:r}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function j(e,n){return(0,t.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function v(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:n,config:r}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(r)})},onSuccess:(n,r)=>{let{serverName:t}=r;e.invalidateQueries({queryKey:["servers",t,"config"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function Z(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers",r]}),e.invalidateQueries({queryKey:["worlds"]})}})}function g(){return(0,t.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function b(){return(0,t.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,t.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function S(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{message:n}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function C(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,7220,8006,1071,540,6189,4840,5511,9654,8657,9030,3669,2757,1744],function(){return e(e.s=61943)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3767],{32823:function(e,t,n){Promise.resolve().then(n.bind(n,32050))},32050:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(94655),s=n(35106),o=n(31358),l=n(7281),c=n(31317),i=n(26138),a=n(41261),u=n(79983),d=n(10117),h=n(73660);function p(e){let{params:t}=e,n=(0,o.x)(),{name:p}=(0,s.use)(t),m=decodeURIComponent(p);return(0,r.jsxs)(l.Z,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,r.jsxs)(l.Z,{sx:{mb:2},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,r.jsx)(u.Z,{onClick:()=>n.push("/servers/".concat(p)),size:"small","aria-label":"Back to server",children:(0,r.jsx)(d.Z,{})}),(0,r.jsxs)(i.Z,{"aria-label":"breadcrumb",children:[(0,r.jsx)(a.Z,{component:"button",variant:"body1",onClick:()=>n.push("/servers"),sx:{cursor:"pointer"},underline:"hover",color:"inherit",children:"Servers"}),(0,r.jsx)(a.Z,{component:"button",variant:"body1",onClick:()=>n.push("/servers/".concat(p)),sx:{cursor:"pointer"},underline:"hover",color:"inherit",children:m}),(0,r.jsx)(c.Z,{color:"text.primary",children:"Console"})]})]}),(0,r.jsxs)(c.Z,{variant:"h5",component:"h1",children:[m," Console"]})]}),(0,r.jsx)(l.Z,{sx:{flex:1,minHeight:0},children:(0,r.jsx)(h.K,{serverName:m})})]})}},3454:function(e,t,n){"use strict";n.d(t,{LoadingProvider:function(){return i},startLoading:function(){return a},stopLoading:function(){return u}});var r=n(94655),s=n(35106),o=n(74228),l=n(31477),c=n.n(l);function i(e){let{children:t}=e,n=(0,o.usePathname)(),l=(0,o.useSearchParams)();return(0,s.useEffect)(()=>{c().done()},[n,l]),(0,r.jsx)(r.Fragment,{children:t})}function a(){c().start()}function u(){c().done()}c().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,n){"use strict";n.d(t,{Av:function(){return r.startLoading}});var r=n(3454)},73660:function(e,t,n){"use strict";n.d(t,{K:function(){return w}});var r=n(94655),s=n(35106),o=n(18844),l=n.n(o),c=n(7281),i=n(69899),a=n(97436),u=n(30417),d=n(90829),h=n(79983),p=n(31317),m=n(25333),f=n(40064),x=n(45547),g=n(70115),v=n(69123),C=n(93017),b=n(11141),S=n(19127),y=n(69366),j=n(163);let R=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],Z=new(l())({fg:"#aaa",bg:"#000",newline:!1,escapeXML:!0,colors:{0:"#000000",1:"#cc0000",2:"#4e9a06",3:"#c4a000",4:"#3465a4",5:"#75507b",6:"#06989a",7:"#d3d7cf",8:"#555753",9:"#ef2929",10:"#8ae234",11:"#fce94f",12:"#729fcf",13:"#ad7fa8",14:"#34e2e2",15:"#eeeeec"}}),k=(0,s.memo)(function(e){let{log:t}=e,n=(0,s.useMemo)(()=>(function(e){let t=e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[KJH]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[KJH]/g,"").replace(/\[m/g,"").replace(/\[(\d+)m/g,"\x1b[$1m").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"");return Z.toHtml(t)})(t),[t]);return(0,r.jsx)(c.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:n}})});function w(e){let{serverName:t}=e,[n,o]=(0,s.useState)(""),[l,Z]=(0,s.useState)([]),[w,E]=(0,s.useState)(-1),[N,O]=(0,s.useState)("ALL"),[T,A]=(0,s.useState)(!0),[I,L]=(0,s.useState)(!0),[z,D]=(0,s.useState)(!1),F=(0,s.useRef)(null),H=(0,s.useRef)(null),{logs:M,isConnected:_,clearLogs:P,reconnect:W,retryCount:K}=(0,j.Y)({serverName:t}),J=(0,s.useMemo)(()=>{let e=M;return I&&(e=e.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient"))),"ALL"!==N&&(e=e.filter(e=>(e.includes("/ERROR]")||e.includes("/ERROR:")?"ERROR":e.includes("/WARN]")||e.includes("/WARN:")?"WARN":(e.includes("/INFO]")||e.includes("/INFO:"),"INFO"))===N)),e},[M,N,I]);(0,s.useEffect)(()=>{T&&H.current&&(H.current.scrollTop=H.current.scrollHeight)},[J,T]);let U=(0,s.useCallback)(async()=>{let e=n.trim();if(e&&!z){D(!0);try{Z(t=>[...t,e]),E(-1),await fetch("/api/servers/".concat(encodeURIComponent(t),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),o("")}catch(e){console.error("Failed to execute command:",e)}finally{D(!1)}}},[n,t,z]),B=(0,s.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),U();else if("ArrowUp"===e.key){if(e.preventDefault(),0===l.length)return;let t=-1===w?l.length-1:Math.max(0,w-1);E(t),o(l[t])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===w)return;let t=w+1;t>=l.length?(E(-1),o("")):(E(t),o(l[t]))}},[l,w,U]),Y=(0,s.useCallback)(e=>{var t;o(e),null===(t=F.current)||void 0===t||t.focus()},[]),Q=_?{text:"Connected",color:"success"}:K>0?{text:"Disconnected (Retry ".concat(K,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,r.jsxs)(i.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,r.jsxs)(c.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(p.Z,{variant:"subtitle2",children:"Console"}),(0,r.jsx)(m.Z,{"data-testid":"connection-status",label:Q.text,color:Q.color,size:"small"})]}),(0,r.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(d.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,r.jsx)(u.Z,{onClick:()=>O(e),variant:N===e?"contained":"outlined",children:e},e))}),(0,r.jsx)(f.Z,{control:(0,r.jsx)(x.Z,{checked:T,onChange:e=>A(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,r.jsx)(f.Z,{control:(0,r.jsx)(x.Z,{checked:I,onChange:e=>L(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,r.jsx)(h.Z,{size:"small",onClick:P,"aria-label":"Clear logs",title:"Clear logs",children:(0,r.jsx)(S.Z,{})}),!_&&(0,r.jsx)(u.Z,{size:"small",startIcon:(0,r.jsx)(y.Z,{}),onClick:W,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,r.jsx)(c.Z,{ref:H,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontFamily:"monospace",fontSize:"0.85rem"},children:0===J.length?(0,r.jsx)(p.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):J.map((e,t)=>(0,r.jsx)(k,{log:e},t))}),(0,r.jsx)(v.Z,{}),(0,r.jsx)(c.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,r.jsxs)(g.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),R.map(e=>(0,r.jsx)(u.Z,{size:"small",variant:"outlined",onClick:()=>Y(e.template),children:e.label},e.label))]})}),(0,r.jsx)(v.Z,{}),(0,r.jsxs)(c.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,r.jsx)(a.Z,{inputRef:F,fullWidth:!0,size:"small",placeholder:"Enter command...",value:n,onChange:e=>o(e.target.value),onKeyDown:B,disabled:!_||z,InputProps:{sx:{fontFamily:"monospace"}}}),(0,r.jsx)(u.Z,{variant:"contained",onClick:U,disabled:!n.trim()||!_||z,startIcon:z?(0,r.jsx)(C.Z,{size:16}):(0,r.jsx)(b.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},31358:function(e,t,n){"use strict";n.d(t,{x:function(){return l}});var r=n(74228),s=n(35106),o=n(8690);function l(){let e=(0,r.useRouter)(),t=(0,s.useCallback)((t,n)=>{(0,o.Av)(),e.push(t,n)},[e]),n=(0,s.useCallback)((t,n)=>{(0,o.Av)(),e.replace(t,n)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:n}),[e,t,n])}},93757:function(e,t,n){"use strict";n.d(t,{D:function(){return o}});var r=n(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,n;let r=JSON.parse(e.data);null===(n=this.options)||void 0===n||null===(t=n.onMessage)||void 0===t||t.call(n,r)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let n={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=n,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,n),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let n=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=n)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let r=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},r)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,n;this.state=e,null===(n=this.options)||void 0===n||null===(t=n.onStateChange)||void 0===t||t.call(n,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function o(e){let{url:t,onMessage:n,onError:o,reconnectInterval:l=3e3,maxReconnectAttempts:c=1/0,enabled:i=!0,withCredentials:a=!1}=e,[u,d]=(0,r.useState)(null),[h,p]=(0,r.useState)("disconnected"),[m,f]=(0,r.useState)(null),[x,g]=(0,r.useState)(0),v=(0,r.useRef)(null),C=(0,r.useCallback)(e=>{d(e),null==n||n(e)},[n]),b=(0,r.useCallback)(e=>{p(e),"connected"===e&&g(0)},[]),S=(0,r.useCallback)(e=>{f(e),"number"==typeof e.retryCount&&g(e.retryCount),null==o||o(e)},[o]),y=(0,r.useCallback)(()=>{v.current&&(v.current.reconnect(),g(v.current.getRetryCount()))},[]),j=(0,r.useCallback)(()=>{v.current&&v.current.disconnect()},[]);return(0,r.useEffect)(()=>{if(!i){v.current&&(v.current.disconnect(),v.current=null);return}return v.current||(v.current=new s),v.current.connect({url:t,onMessage:C,onStateChange:b,onError:S,reconnectInterval:l,maxReconnectAttempts:c,withCredentials:a}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[t,i,l,c,a,C,b,S]),{data:u,isConnected:"connected"===h,state:h,error:m,retryCount:x,reconnect:y,disconnect:j}}},163:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});var r=n(35106),s=n(93757);function o(e){let{serverName:t,maxLines:n=500,enabled:o=!0,reconnectInterval:l=3e3}=e,[c,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{i([])},[t]);let a=(0,r.useCallback)(e=>{let t;"server-log"===e.type?t=e.data.log:"log"in e&&"string"==typeof e.log&&(t=e.log),t&&i(e=>{let r=[...e,t];return r.length>n?r.slice(r.length-n):r})},[n]),{isConnected:u,reconnect:d,retryCount:h}=(0,s.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/logs"),onMessage:a,enabled:o,reconnectInterval:l});return{logs:c,isConnected:u,clearLogs:(0,r.useCallback)(()=>{i([])},[]),reconnect:d,retryCount:h}}}},function(e){e.O(0,[6812,7220,6803,7294,1604,4538,6357,5375,3669,2757,1744],function(){return e(e.s=32823)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3767],{32823:function(e,t,n){Promise.resolve().then(n.bind(n,32050))},32050:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(94655),s=n(35106),o=n(31358),l=n(7281),c=n(31317),i=n(26138),a=n(41261),u=n(79983),d=n(10117),h=n(73660);function p(e){let{params:t}=e,n=(0,o.x)(),{name:p}=(0,s.use)(t),m=decodeURIComponent(p);return(0,r.jsxs)(l.Z,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,r.jsxs)(l.Z,{sx:{mb:2},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,r.jsx)(u.Z,{onClick:()=>n.push("/servers/".concat(p)),size:"small","aria-label":"Back to server",children:(0,r.jsx)(d.Z,{})}),(0,r.jsxs)(i.Z,{"aria-label":"breadcrumb",children:[(0,r.jsx)(a.Z,{component:"button",variant:"body1",onClick:()=>n.push("/servers"),sx:{cursor:"pointer"},underline:"hover",color:"inherit",children:"Servers"}),(0,r.jsx)(a.Z,{component:"button",variant:"body1",onClick:()=>n.push("/servers/".concat(p)),sx:{cursor:"pointer"},underline:"hover",color:"inherit",children:m}),(0,r.jsx)(c.Z,{color:"text.primary",children:"Console"})]})]}),(0,r.jsxs)(c.Z,{variant:"h5",component:"h1",children:[m," Console"]})]}),(0,r.jsx)(l.Z,{sx:{flex:1,minHeight:0},children:(0,r.jsx)(h.K,{serverName:m})})]})}},3454:function(e,t,n){"use strict";n.d(t,{LoadingProvider:function(){return i},startLoading:function(){return a},stopLoading:function(){return u}});var r=n(94655),s=n(35106),o=n(74228),l=n(31477),c=n.n(l);function i(e){let{children:t}=e,n=(0,o.usePathname)(),l=(0,o.useSearchParams)();return(0,s.useEffect)(()=>{c().done()},[n,l]),(0,r.jsx)(r.Fragment,{children:t})}function a(){c().start()}function u(){c().done()}c().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,n){"use strict";n.d(t,{Av:function(){return r.startLoading}});var r=n(3454)},73660:function(e,t,n){"use strict";n.d(t,{K:function(){return w}});var r=n(94655),s=n(35106),o=n(18844),l=n.n(o),c=n(7281),i=n(69899),a=n(97436),u=n(30417),d=n(90829),h=n(79983),p=n(31317),m=n(25333),f=n(40064),x=n(45547),g=n(70115),v=n(69123),C=n(93017),b=n(11141),S=n(19127),y=n(69366),j=n(163);let R=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],Z=new(l())({fg:"#aaa",bg:"#000",newline:!1,escapeXML:!0,colors:{0:"#000000",1:"#cc0000",2:"#4e9a06",3:"#c4a000",4:"#3465a4",5:"#75507b",6:"#06989a",7:"#d3d7cf",8:"#555753",9:"#ef2929",10:"#8ae234",11:"#fce94f",12:"#729fcf",13:"#ad7fa8",14:"#34e2e2",15:"#eeeeec"}}),k=(0,s.memo)(function(e){let{log:t}=e,n=(0,s.useMemo)(()=>(function(e){let t=e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[KJH]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[KJH]/g,"").replace(/\[m/g,"").replace(/\[(\d+)m/g,"\x1b[$1m").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"");return Z.toHtml(t)})(t),[t]);return(0,r.jsx)(c.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:n}})});function w(e){let{serverName:t}=e,[n,o]=(0,s.useState)(""),[l,Z]=(0,s.useState)([]),[w,E]=(0,s.useState)(-1),[N,O]=(0,s.useState)("ALL"),[T,A]=(0,s.useState)(!0),[I,L]=(0,s.useState)(!0),[z,D]=(0,s.useState)(!1),F=(0,s.useRef)(null),H=(0,s.useRef)(null),{logs:M,isConnected:_,clearLogs:P,reconnect:W,retryCount:K}=(0,j.Y)({serverName:t}),J=(0,s.useMemo)(()=>{let e=M;return I&&(e=e.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient"))),"ALL"!==N&&(e=e.filter(e=>(e.includes("/ERROR]")||e.includes("/ERROR:")?"ERROR":e.includes("/WARN]")||e.includes("/WARN:")?"WARN":(e.includes("/INFO]")||e.includes("/INFO:"),"INFO"))===N)),e},[M,N,I]);(0,s.useEffect)(()=>{T&&H.current&&(H.current.scrollTop=H.current.scrollHeight)},[J,T]);let U=(0,s.useCallback)(async()=>{let e=n.trim();if(e&&!z){D(!0);try{Z(t=>[...t,e]),E(-1),await fetch("/api/servers/".concat(encodeURIComponent(t),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),o("")}catch(e){console.error("Failed to execute command:",e)}finally{D(!1)}}},[n,t,z]),B=(0,s.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),U();else if("ArrowUp"===e.key){if(e.preventDefault(),0===l.length)return;let t=-1===w?l.length-1:Math.max(0,w-1);E(t),o(l[t])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===w)return;let t=w+1;t>=l.length?(E(-1),o("")):(E(t),o(l[t]))}},[l,w,U]),Y=(0,s.useCallback)(e=>{var t;o(e),null===(t=F.current)||void 0===t||t.focus()},[]),Q=_?{text:"Connected",color:"success"}:K>0?{text:"Disconnected (Retry ".concat(K,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,r.jsxs)(i.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,r.jsxs)(c.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(p.Z,{variant:"subtitle2",children:"Console"}),(0,r.jsx)(m.Z,{"data-testid":"connection-status",label:Q.text,color:Q.color,size:"small"})]}),(0,r.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(d.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,r.jsx)(u.Z,{onClick:()=>O(e),variant:N===e?"contained":"outlined",children:e},e))}),(0,r.jsx)(f.Z,{control:(0,r.jsx)(x.Z,{checked:T,onChange:e=>A(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,r.jsx)(f.Z,{control:(0,r.jsx)(x.Z,{checked:I,onChange:e=>L(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,r.jsx)(h.Z,{size:"small",onClick:P,"aria-label":"Clear logs",title:"Clear logs",children:(0,r.jsx)(S.Z,{})}),!_&&(0,r.jsx)(u.Z,{size:"small",startIcon:(0,r.jsx)(y.Z,{}),onClick:W,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,r.jsx)(c.Z,{ref:H,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontFamily:"monospace",fontSize:"0.85rem"},children:0===J.length?(0,r.jsx)(p.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):J.map((e,t)=>(0,r.jsx)(k,{log:e},t))}),(0,r.jsx)(v.Z,{}),(0,r.jsx)(c.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,r.jsxs)(g.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),R.map(e=>(0,r.jsx)(u.Z,{size:"small",variant:"outlined",onClick:()=>Y(e.template),children:e.label},e.label))]})}),(0,r.jsx)(v.Z,{}),(0,r.jsxs)(c.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,r.jsx)(a.Z,{inputRef:F,fullWidth:!0,size:"small",placeholder:"Enter command...",value:n,onChange:e=>o(e.target.value),onKeyDown:B,disabled:!_||z,InputProps:{sx:{fontFamily:"monospace"}}}),(0,r.jsx)(u.Z,{variant:"contained",onClick:U,disabled:!n.trim()||!_||z,startIcon:z?(0,r.jsx)(C.Z,{size:16}):(0,r.jsx)(b.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},31358:function(e,t,n){"use strict";n.d(t,{x:function(){return l}});var r=n(74228),s=n(35106),o=n(8690);function l(){let e=(0,r.useRouter)(),t=(0,s.useCallback)((t,n)=>{(0,o.Av)(),e.push(t,n)},[e]),n=(0,s.useCallback)((t,n)=>{(0,o.Av)(),e.replace(t,n)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:n}),[e,t,n])}},93757:function(e,t,n){"use strict";n.d(t,{D:function(){return o}});var r=n(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,n;let r=JSON.parse(e.data);null===(n=this.options)||void 0===n||null===(t=n.onMessage)||void 0===t||t.call(n,r)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let n={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=n,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,n),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let n=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=n)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let r=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},r)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,n;this.state=e,null===(n=this.options)||void 0===n||null===(t=n.onStateChange)||void 0===t||t.call(n,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function o(e){let{url:t,onMessage:n,onError:o,reconnectInterval:l=3e3,maxReconnectAttempts:c=1/0,enabled:i=!0,withCredentials:a=!1}=e,[u,d]=(0,r.useState)(null),[h,p]=(0,r.useState)("disconnected"),[m,f]=(0,r.useState)(null),[x,g]=(0,r.useState)(0),v=(0,r.useRef)(null),C=(0,r.useCallback)(e=>{d(e),null==n||n(e)},[n]),b=(0,r.useCallback)(e=>{p(e),"connected"===e&&g(0)},[]),S=(0,r.useCallback)(e=>{f(e),"number"==typeof e.retryCount&&g(e.retryCount),null==o||o(e)},[o]),y=(0,r.useCallback)(()=>{v.current&&(v.current.reconnect(),g(v.current.getRetryCount()))},[]),j=(0,r.useCallback)(()=>{v.current&&v.current.disconnect()},[]);return(0,r.useEffect)(()=>{if(!i){v.current&&(v.current.disconnect(),v.current=null);return}return v.current||(v.current=new s),v.current.connect({url:t,onMessage:C,onStateChange:b,onError:S,reconnectInterval:l,maxReconnectAttempts:c,withCredentials:a}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[t,i,l,c,a,C,b,S]),{data:u,isConnected:"connected"===h,state:h,error:m,retryCount:x,reconnect:y,disconnect:j}}},163:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});var r=n(35106),s=n(93757);function o(e){let{serverName:t,maxLines:n=500,enabled:o=!0,reconnectInterval:l=3e3}=e,[c,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{i([])},[t]);let a=(0,r.useCallback)(e=>{let t;"server-log"===e.type?t=e.data.log:"log"in e&&"string"==typeof e.log&&(t=e.log),t&&i(e=>{let r=[...e,t];return r.length>n?r.slice(r.length-n):r})},[n]),{isConnected:u,reconnect:d,retryCount:h}=(0,s.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/logs"),onMessage:a,enabled:o,reconnectInterval:l});return{logs:c,isConnected:u,clearLogs:(0,r.useCallback)(()=>{i([])},[]),reconnect:d,retryCount:h}}}},function(e){e.O(0,[6812,7220,8006,7294,8696,4538,6645,1476,3669,2757,1744],function(){return e(e.s=32823)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,r,s){Promise.resolve().then(s.bind(s,41517))},41517:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return eL}});var t=s(94655),n=s(35106),i=s(74228),a=s(31358),l=s(7281),o=s(30417),d=s(79983),c=s(81071),x=s(93017),h=s(10721),u=s(628),m=s(41565),p=s(31317),j=s(35694),g=s(7178),v=s(17820),Z=s(73424),f=s(99770),b=s(62508),y=s(5682),C=s(76678),w=s(97436),S=s(84840),R=s(76492),k=s(10117),I=s(5501),P=s(37809),z=s(21111),W=s(17978),F=s(89573),O=s(96292),A=s(33104),M=s(25333),T=s(52082),D=s(69123),E=s(71185),B=s(30165),N=s(97293),U=s(11259),L=s(66615),H=s(89161),q=s(34071),K=s(4405);function G(e){let{value:r,unit:s,label:n,icon:i,progress:a,progressMax:o,color:d="#1bd96a"}=e;return(0,t.jsxs)(u.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",fontFamily:"'JetBrains Mono', 'Fira Code', monospace",letterSpacing:"-0.5px"},children:r}),(0,t.jsx)(p.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:s})]}),(0,t.jsx)(l.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,t.jsx)(p.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:n}),(0,t.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 _=s(163),J=s(73660),V=s(90158),Q=s(58347),Y=s(95511),$=s(46725),X=s(26577),ee=s(56813),er=s(26892),es=s(84509);function et(e){var r;let{serverName:s}=e,{data:n,isLoading:i,error:a}=(0,es.HZ)(s,{limit:20});if(i)return(0,t.jsx)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:60,height:24}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"}),(0,t.jsx)(h.Z,{variant:"text",width:50})]},r))});if(a)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load activity: ",a.message]});let d=null!==(r=null==n?void 0:n.logs)&&void 0!==r?r:[];if(0===d.length)return(0,t.jsx)(p.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(s));return(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(V.Z,{sx:{py:0},children:d.map(e=>{var r;return(0,t.jsx)(Q.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,t.jsx)(Z.Z,{primary:(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ee.I,{action:e.action,size:"small"}),(0,t.jsxs)(p.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),(0,t.jsx)(er.c,{status:e.status,size:"small"})]}),secondary:(0,t.jsx)(Y.Z,{title:(r=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(r))),arrow:!0,children:(0,t.jsx)(p.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let r=new Date,s=new Date(e),t=Math.floor((r.getTime()-s.getTime())/6e4),n=Math.floor(t/60);return t<1?"just now":t<60?"".concat(t,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(e.timestamp)})})})},e.id)})}),(0,t.jsx)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,t.jsx)(o.Z,{component:$.default,href:x,size:"small",endIcon:(0,t.jsx)(X.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var en=s(62328),ei=s(29793),ea=s(75726),el=s(40064),eo=s(38393),ed=s(37530),ec=s(5942),ex=s(84420),eh=s(46121),eu=s(84775),em=s(92666);function ep(e){var r,s;let{serverName:i,isRunning:a}=e,{data:d,isLoading:h}=(0,em.iC)(i),j=(0,em.MH)(),v=(0,em.gx)(),[Z,R]=(0,n.useState)({}),[k,I]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[W,F]=(0,n.useState)(!1),[O,A]=(0,n.useState)(""),[M,T]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==d?void 0:d.config)&&R(d.config)},[d]);let E=(e,r)=>{R(s=>({...s,[e]:r})),I(!0),("memory"===e||"useAikarFlags"===e)&&z(!0)},B=async()=>{try{let e=await j.mutateAsync({serverName:i,config:Z});T({open:!0,message:e.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:e.restartRequired?"warning":"success"}),I(!1),z(!1)}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}},N=async()=>{if("RESET"!==O){T({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await v.mutateAsync(i),T({open:!0,message:"World reset successfully",severity:"success"}),F(!1),A("")}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return h?(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(x.Z,{})}):(0,t.jsxs)(l.Z,{children:[P&&(0,t.jsx)(c.Z,{severity:"warning",icon:(0,t.jsx)(ex.Z,{}),sx:{mb:3},children:"Performance settings require a server restart to take effect."}),(0,t.jsx)(u.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Properties"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings can be changed without restarting the server."}),(0,t.jsx)(D.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"MOTD (Message of the Day)",value:Z.motd||"",onChange:e=>E("motd",e.target.value),helperText:"The message displayed in the server list"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Max Players",value:Z.maxPlayers||20,onChange:e=>E("maxPlayers",parseInt(e.target.value,10)),inputProps:{min:1,max:100}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Difficulty"}),(0,t.jsxs)(en.Z,{value:Z.difficulty||"normal",label:"Difficulty",onChange:e=>E("difficulty",e.target.value),children:[(0,t.jsx)(g.Z,{value:"peaceful",children:"Peaceful"}),(0,t.jsx)(g.Z,{value:"easy",children:"Easy"}),(0,t.jsx)(g.Z,{value:"normal",children:"Normal"}),(0,t.jsx)(g.Z,{value:"hard",children:"Hard"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Game Mode"}),(0,t.jsxs)(en.Z,{value:Z.gameMode||"survival",label:"Game Mode",onChange:e=>E("gameMode",e.target.value),children:[(0,t.jsx)(g.Z,{value:"survival",children:"Survival"}),(0,t.jsx)(g.Z,{value:"creative",children:"Creative"}),(0,t.jsx)(g.Z,{value:"adventure",children:"Adventure"}),(0,t.jsx)(g.Z,{value:"spectator",children:"Spectator"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null===(r=Z.pvp)||void 0===r||r,onChange:e=>E("pvp",e.target.checked)}),label:"Enable PvP"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"View Distance (chunks)",value:Z.viewDistance||10,onChange:e=>E("viewDistance",parseInt(e.target.value,10)),inputProps:{min:3,max:32}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Spawn Protection (blocks)",value:Z.spawnProtection||16,onChange:e=>E("spawnProtection",parseInt(e.target.value,10)),inputProps:{min:0,max:128}})})]})]})}),(0,t.jsx)(u.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Performance Settings"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings require a server restart to take effect."}),(0,t.jsx)(D.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"Memory Allocation",value:Z.memory||"4G",onChange:e=>E("memory",e.target.value),helperText:"Format: 4G, 8G, etc."})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null!==(s=Z.useAikarFlags)&&void 0!==s&&s,onChange:e=>E("useAikarFlags",e.target.checked)}),label:"Use Aikar's Flags (Optimized GC)"})})]})]})}),(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,t.jsx)(o.Z,{variant:"contained",size:"large",startIcon:(0,t.jsx)(ec.Z,{}),onClick:B,disabled:!k||j.isPending,sx:{px:4},children:j.isPending?"Saving...":"Save Changes"})}),(0,t.jsx)(u.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,t.jsx)(D.Z,{sx:{mb:3}}),(0,t.jsxs)(l.Z,{sx:{mb:3},children:[(0,t.jsx)(p.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,t.jsx)(p.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,t.jsx)(o.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(eu.Z,{}),onClick:()=>F(!0),disabled:a,children:"Reset World"}),a&&(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,t.jsxs)(f.Z,{open:W,onClose:()=>F(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ex.Z,{color:"error"}),(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(p.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,t.jsx)("strong",{children:i})," and generate a new one."]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,t.jsx)(w.Z,{fullWidth:!0,label:"Type RESET to confirm",value:O,onChange:e=>A(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,t.jsxs)(C.Z,{children:[(0,t.jsx)(o.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:N,disabled:"RESET"!==O||v.isPending,startIcon:v.isPending?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eh.Z,{}),children:v.isPending?"Resetting...":"Reset World"})]})]}),(0,t.jsx)(ed.Z,{open:M.open,autoHideDuration:6e3,onClose:()=>T({...M,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>T({...M,open:!1}),severity:M.severity,sx:{width:"100%"},children:M.message})})]})}var ej=s(86702),eg=s(47606),ev=s(407),eZ=s(56056),ef=s(28058),eb=s(11597),ey=s(59602);let eC={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function ew(e){let{permission:r,size:s="medium"}=e,n=eC[r];return(0,t.jsx)(M.Z,{label:n.label,color:n.color,variant:n.variant,size:s})}var eS=s(99046),eR=s(68038),ek=s(34080),eI=s(39181),eP=s(5632),ez=s(58919),eW=s(20367),eF=s(42936);function eO(e){var r,s;let{open:i,onClose:a,serverId:d}=e,[h,u]=(0,n.useState)(""),[m,j]=(0,n.useState)(null),[g,v]=(0,n.useState)("view"),{data:Z,isLoading:S}=(s={enabled:i},(0,eP.a)({queryKey:["users","search",h],queryFn:()=>(0,eF.SC)("/api/users?q=".concat(encodeURIComponent(h))),enabled:(null==s?void 0:s.enabled)!==!1&&h.length>=2,staleTime:3e4})),R=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["user-servers",s.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),k=(0,n.useMemo)(()=>{var e;return null!==(e=null==Z?void 0:Z.users)&&void 0!==e?e:[]},[Z]),I=()=>{u(""),j(null),v("view"),R.reset(),a()};return(0,t.jsxs)(f.Z,{open:i,onClose:I,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,t.jsx)(b.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,t.jsxs)(y.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[R.isError&&(0,t.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(r=R.error)||void 0===r?void 0:r.message)||"Failed to grant access"}),(0,t.jsx)(eS.Z,{options:k,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,r)=>e.id===r.id,value:m,onChange:(e,r)=>j(r),inputValue:h,onInputChange:(e,r)=>u(r),loading:S,filterOptions:e=>e,noOptionsText:h.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,t.jsx)(w.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,t.jsxs)(t.Fragment,{children:[S&&(0,t.jsx)(x.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,r)=>{var s,n,i;let{key:a,...o}=e;return(0,t.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,t.jsx)(ej.Z,{src:null!==(i=r.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(s=r.name)||void 0===s?void 0:s[0])||(null===(n=r.email)||void 0===n?void 0:n[0])||"?").toUpperCase()}),(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:r.name||"Unknown"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:r.email})]})]},a)}}),(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)(eR.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,t.jsxs)(ek.Z,{value:g,onChange:e=>v(e.target.value),children:[(0,t.jsx)(el.Z,{value:"view",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,t.jsx)(el.Z,{value:"manage",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,t.jsx)(el.Z,{value:"admin",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(o.Z,{onClick:I,color:"inherit",children:"Cancel"}),(0,t.jsx)(o.Z,{onClick:()=>{m&&R.mutate({userId:m.id,serverId:d,permission:g},{onSuccess:I})},variant:"contained",disabled:!m||R.isPending,sx:{borderRadius:2},children:R.isPending?"Adding...":"Add User"})]})]})}function eA(e){var r,s;let{serverId:i}=e,{data:a,isLoading:x,error:f}=(0,eP.a)({queryKey:["user-servers",i],queryFn:()=>(0,eF.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),b=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>{let{id:r,permission:s}=e;return(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(r)),{method:"PATCH",body:JSON.stringify({permission:s})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),y=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,w]=(0,n.useState)(!1),[S,R]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),z=(e,r)=>{R(e.currentTarget),I(r)},W=()=>{R(null),I(null)},F=e=>{if(!k||k.permission===e){W();return}b.mutate({id:k.id,permission:e},{onSettled:W})},O=null!==(r=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==r?r:0,A=(null==k?void 0:k.permission)==="admin"&&O<=1;if(x)return(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:32}),(0,t.jsx)(h.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,t.jsx)(D.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,t.jsx)(h.Z,{variant:"circular",width:40,height:40}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%"}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"})]}),(0,t.jsx)(h.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,t.jsx)(h.Z,{variant:"circular",width:32,height:32})]},e))]})});if(f)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",f.message]});let M=null!==(s=null==a?void 0:a.users)&&void 0!==s?s:[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,t.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(eg.Z,{}),onClick:()=>w(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,t.jsx)(D.Z,{sx:{mb:1}}),0===M.length?(0,t.jsx)(l.Z,{sx:{py:4,textAlign:"center"},children:(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):M.map(e=>{var r,s,n,i,a,o,c,x;return(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,t.jsx)(ej.Z,{src:null!==(x=null===(r=e.user)||void 0===r?void 0:r.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===(s=n.name)||void 0===s?void 0:s[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,t.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.name)||"Unknown User"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(c=e.user)||void 0===c?void 0:c.email)||e.userId})]}),(0,t.jsx)(ew,{permission:e.permission,size:"small"}),(0,t.jsx)(d.Z,{size:"small",onClick:r=>z(r,e),sx:{color:"text.secondary"},children:(0,t.jsx)(P.Z,{fontSize:"small"})})]},e.id)}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,t.jsx)(ey.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,t.jsxs)(j.Z,{anchorEl:S,open:!!S,onClose:W,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,t.jsxs)(g.Z,{onClick:()=>F("admin"),disabled:(null==k?void 0:k.permission)==="admin",children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ev.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Owner"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("manage"),disabled:(null==k?void 0:k.permission)==="manage"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eZ.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Operator"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("view"),disabled:(null==k?void 0:k.permission)==="view"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ef.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Viewer"})]}),(0,t.jsx)(D.Z,{}),(0,t.jsxs)(g.Z,{onClick:()=>{k&&y.mutate(k.id,{onSettled:W})},disabled:A,sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eb.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Remove Access"})]})]}),(0,t.jsx)(eO,{open:C,onClose:()=>w(!1),serverId:i})]})}let eM=["Overview","Activity","Content","Files","Backups","Access","Options"];function eT(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 eD(e){var r,s,i,a,c;let{server:x,onSendCommand:h}=e,[j,g]=(0,n.useState)("Overview"),[v,Z]=(0,n.useState)(""),[b,C]=(0,n.useState)(!0),[k,I]=(0,n.useState)(!1),P=(0,n.useRef)(null),{logs:z,isConnected:W}=(0,_.Y)({serverName:x.name}),F=(0,n.useMemo)(()=>z.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[z]);(0,n.useEffect)(()=>{P.current&&b&&(P.current.scrollTop=P.current.scrollHeight)},[F,b]);let O=async()=>{v.trim()&&h&&(await h(v.trim()),Z(""))},A=null!==(a=null===(r=x.stats)||void 0===r?void 0:r.cpuPercent)&&void 0!==a?a:0;(null===(s=x.stats)||void 0===s?void 0:s.memoryUsage)&&x.stats.memoryUsage,function(e){if(!e)return;let r=e.match(/^(\d+)\s*(M|G)?$/i);if(r)parseInt(r[1],10),(r[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,t.jsxs)(l.Z,{children:[(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:eM.map(e=>(0,t.jsx)(o.Z,{onClick:()=>g(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:j===e?"primary.main":"transparent",color:j===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:j===e?"primary.main":(0,R.Fq)("#1bd96a",.1)}},children:e},e))}),(0,t.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,t.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,t.jsx)(B.Z,{sx:{fontSize:28}}),progress:A,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:"".concat(K.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,t.jsx)(N.Z,{sx:{fontSize:28}}),progress:K,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:x.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,t.jsx)(U.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let r=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!r)return 0;let s=parseFloat(r[1]);switch((r[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*s;case"MB":case"MIB":return s;case"KB":return s/1024;default:return s/1048576}}(x.worldSize),progressMax:10240,color:"#1bd96a"})]}),(0,t.jsxs)(u.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,t.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(p.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,t.jsx)(l.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:W?"primary.main":"error.main",boxShadow:W?"0 0 8px rgba(27, 217, 106, 0.4)":"0 0 8px rgba(239, 68, 68, 0.4)"}})]}),(0,t.jsxs)(l.Z,{sx:{position:"relative"},children:[(0,t.jsx)(l.Z,{ref:P,onScroll:()=>{if(!P.current)return;let{scrollTop:e,scrollHeight:r,clientHeight:s}=P.current;C(r-e-s<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===F.length?(0,t.jsx)(p.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):F.map((e,r)=>{let s=function(e){let r=eT(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return r?{time:r[1],thread:r[2],level:r[3]||"INFO",msg:r[4]}:null}(e);return s?(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",s.time,"]"]}),(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",s.thread,"/",(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#e8a848":"#6b6e80"},children:s.level}),"]:\xa0"]}),(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#c4a45a":"#b4b6c4"},children:s.msg})]},r):(0,t.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:eT(e)},r)})}),(0,t.jsx)(d.Z,{onClick:()=>I(!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,t.jsx)(L.Z,{sx:{fontSize:18}})}),!b&&(0,t.jsx)(d.Z,{onClick:()=>{P.current&&P.current.scrollTo({top:P.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,t.jsx)(H.Z,{sx:{fontSize:18}})})]}),(0,t.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(w.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:v,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),O())},disabled:!W,InputProps:{startAdornment:(0,t.jsx)(T.Z,{position:"start",children:(0,t.jsx)(q.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"===j&&(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,t.jsx)(D.Z,{sx:{mb:2}}),(0,t.jsx)(eE,{label:"Name",value:x.name}),(0,t.jsx)(eE,{label:"Container",value:x.container}),(0,t.jsx)(eE,{label:"Hostname",value:x.hostname}),(0,t.jsx)(eE,{label:"Type",value:x.type}),(0,t.jsx)(eE,{label:"Version",value:x.version}),(0,t.jsx)(eE,{label:"Memory",value:x.memory}),(0,t.jsx)(eE,{label:"Uptime",value:x.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(x.uptimeSeconds)})]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,t.jsx)(D.Z,{sx:{mb:2}}),x.players?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eE,{label:"Online",value:"".concat(x.players.online," / ").concat(x.players.max)}),x.players.list&&x.players.list.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,t.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.list.map(e=>(0,t.jsx)(M.Z,{label:e,size:"small"},e))})]})]}):(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})})]}),"Activity"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,t.jsx)(D.Z,{sx:{mb:2}}),(0,t.jsx)(et,{serverName:x.name})]})})}),"Content"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Content management coming soon"})}),"Files"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(eA,{serverId:x.name})}),"Options"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(ep,{serverName:x.name,isRunning:"running"===x.status})}),(0,t.jsxs)(f.Z,{open:k,onClose:()=>I(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(p.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",x.name]}),(0,t.jsx)(d.Z,{onClick:()=>I(!1),children:(0,t.jsx)(E.Z,{})})]}),(0,t.jsx)(y.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(J.K,{serverName:x.name})})]})]})}function eE(e){let{label:r,value:s}=e;return s?(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:r}),(0,t.jsx)(p.Z,{variant:"body2",sx:{fontWeight:500},children:s})]}):null}var eB=s(93757);function eN(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function eU(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 2v6h-6"}),(0,t.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,t.jsx)("path",{d:"M3 22v-6h6"}),(0,t.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function eL(){var e,r,s,M;let T=(0,i.useParams)(),D=(0,a.x)(),E=decodeURIComponent(T.name),{data:B,isLoading:N,error:U}=(0,em.Hy)(E),{status:L,health:H}=function(e){let{serverName:r,onStatusChange:s,enabled:t=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,n.useState)(null),[o,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{l(null),d(null)},[r]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let r=e.data.status,t=e.data.health;l(r),d(t),null==s||s(r,t)}},[s]),{isConnected:x,reconnect:h,retryCount:u}=(0,eB.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/status"),onMessage:c,enabled:t,reconnectInterval:i});return{status:a,health:o,isConnected:x,reconnect:h,retryCount:u}}({serverName:E,enabled:!!E}),[q,K]=(0,n.useState)(null),[G,_]=(0,n.useState)(!1),[J,V]=(0,n.useState)(""),Q=(0,em.jM)(),Y=(0,em.Aw)(),$=(0,em._I)(),X=(0,em.Hq)(),ee=async()=>{try{await Q.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},er=async()=>{try{await Y.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},es=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},et=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=L||(null==B?void 0:B.server.status),ei=Q.isPending||Y.isPending||$.isPending,ea=null==B?void 0:B.server;return(0,t.jsxs)(t.Fragment,{children:[U&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",U.message]}),Q.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=Q.error)||void 0===e?void 0:e.message]}),Y.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(r=Y.error)||void 0===r?void 0:r.message]}),$.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(s=$.error)||void 0===s?void 0:s.message]}),X.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(M=X.error)||void 0===M?void 0:M.message]}),N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:40}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,t.jsx)(h.Z,{variant:"text",width:100}),(0,t.jsx)(h.Z,{variant:"text",width:60}),(0,t.jsx)(h.Z,{variant:"text",width:140}),(0,t.jsx)(h.Z,{variant:"text",width:50})]})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,t.jsx)(h.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,r)=>(0,t.jsx)(h.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},r))}),(0,t.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,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,t.jsx)(h.Z,{variant:"text",width:"50%"}),(0,t.jsx)(h.Z,{variant:"circular",width:28,height:28})]}),(0,t.jsx)(h.Z,{variant:"text",width:"60%",height:36}),(0,t.jsx)(h.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,t.jsxs)(u.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,t.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:28}),(0,t.jsx)(h.Z,{variant:"circular",width:10,height:10})]}),(0,t.jsx)(h.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,t.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(h.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%"}),(0,t.jsx)(h.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"25%"}),(0,t.jsx)(h.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.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 r=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(r)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(r)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsxs)(p.Z,{onClick:()=>D.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,t.jsx)(k.Z,{sx:{fontSize:14}})," All servers"]}),(0,t.jsx)(p.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,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(W.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(O.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(A.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,t.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(I.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===en&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{variant:"outlined",startIcon:ei?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eN,{}),onClick:er,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,R.Fq)("#fff",.05)}},children:"Stop"}),(0,t.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(eU,{}),onClick:es,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,t.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,t.jsx)(P.Z,{sx:{fontSize:18}})}),(0,t.jsx)(j.Z,{anchorEl:q,open:!!q,onClose:()=>K(null),children:(0,t.jsxs)(g.Z,{onClick:()=>{K(null),_(!0),V("")},sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(z.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Delete Server"})]})})]})]}),(0,t.jsx)(eD,{server:ea,onSendCommand:et})]}):(0,t.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,t.jsxs)(f.Z,{open:G,onClose:()=>{_(!1),V("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:"Delete Server"}),(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(p.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:E})," to confirm deletion."]}),(0,t.jsx)(w.Z,{label:"Server name",value:J,onChange:e=>V(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(o.Z,{onClick:()=>{_(!1),V("")},children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{J===E&&X.mutate({name:E,force:!0},{onSuccess:()=>{D.push("/servers")}})},disabled:J!==E||X.isPending,startIcon:X.isPending?(0,t.jsx)(x.Z,{size:16}):null,children:X.isPending?"Deleting...":"Delete"})]})]})]})}},73660:function(e,r,s){"use strict";s.d(r,{K:function(){return k}});var t=s(94655),n=s(35106),i=s(18844),a=s.n(i),l=s(7281),o=s(69899),d=s(97436),c=s(30417),x=s(90829),h=s(79983),u=s(31317),m=s(25333),p=s(40064),j=s(45547),g=s(70115),v=s(69123),Z=s(93017),f=s(11141),b=s(19127),y=s(69366),C=s(163);let w=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],S=new(a())({fg:"#aaa",bg:"#000",newline:!1,escapeXML:!0,colors:{0:"#000000",1:"#cc0000",2:"#4e9a06",3:"#c4a000",4:"#3465a4",5:"#75507b",6:"#06989a",7:"#d3d7cf",8:"#555753",9:"#ef2929",10:"#8ae234",11:"#fce94f",12:"#729fcf",13:"#ad7fa8",14:"#34e2e2",15:"#eeeeec"}}),R=(0,n.memo)(function(e){let{log:r}=e,s=(0,n.useMemo)(()=>(function(e){let r=e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[KJH]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[KJH]/g,"").replace(/\[m/g,"").replace(/\[(\d+)m/g,"\x1b[$1m").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"");return S.toHtml(r)})(r),[r]);return(0,t.jsx)(l.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:s}})});function k(e){let{serverName:r}=e,[s,i]=(0,n.useState)(""),[a,S]=(0,n.useState)([]),[k,I]=(0,n.useState)(-1),[P,z]=(0,n.useState)("ALL"),[W,F]=(0,n.useState)(!0),[O,A]=(0,n.useState)(!0),[M,T]=(0,n.useState)(!1),D=(0,n.useRef)(null),E=(0,n.useRef)(null),{logs:B,isConnected:N,clearLogs:U,reconnect:L,retryCount:H}=(0,C.Y)({serverName:r}),q=(0,n.useMemo)(()=>{let e=B;return O&&(e=e.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient"))),"ALL"!==P&&(e=e.filter(e=>(e.includes("/ERROR]")||e.includes("/ERROR:")?"ERROR":e.includes("/WARN]")||e.includes("/WARN:")?"WARN":(e.includes("/INFO]")||e.includes("/INFO:"),"INFO"))===P)),e},[B,P,O]);(0,n.useEffect)(()=>{W&&E.current&&(E.current.scrollTop=E.current.scrollHeight)},[q,W]);let K=(0,n.useCallback)(async()=>{let e=s.trim();if(e&&!M){T(!0);try{S(r=>[...r,e]),I(-1),await fetch("/api/servers/".concat(encodeURIComponent(r),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),i("")}catch(e){console.error("Failed to execute command:",e)}finally{T(!1)}}},[s,r,M]),G=(0,n.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),K();else if("ArrowUp"===e.key){if(e.preventDefault(),0===a.length)return;let r=-1===k?a.length-1:Math.max(0,k-1);I(r),i(a[r])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===k)return;let r=k+1;r>=a.length?(I(-1),i("")):(I(r),i(a[r]))}},[a,k,K]),_=(0,n.useCallback)(e=>{var r;i(e),null===(r=D.current)||void 0===r||r.focus()},[]),J=N?{text:"Connected",color:"success"}:H>0?{text:"Disconnected (Retry ".concat(H,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,t.jsxs)(o.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(u.Z,{variant:"subtitle2",children:"Console"}),(0,t.jsx)(m.Z,{"data-testid":"connection-status",label:J.text,color:J.color,size:"small"})]}),(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(x.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,t.jsx)(c.Z,{onClick:()=>z(e),variant:P===e?"contained":"outlined",children:e},e))}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:W,onChange:e=>F(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:O,onChange:e=>A(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,t.jsx)(h.Z,{size:"small",onClick:U,"aria-label":"Clear logs",title:"Clear logs",children:(0,t.jsx)(b.Z,{})}),!N&&(0,t.jsx)(c.Z,{size:"small",startIcon:(0,t.jsx)(y.Z,{}),onClick:L,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,t.jsx)(l.Z,{ref:E,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontFamily:"monospace",fontSize:"0.85rem"},children:0===q.length?(0,t.jsx)(u.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):q.map((e,r)=>(0,t.jsx)(R,{log:e},r))}),(0,t.jsx)(v.Z,{}),(0,t.jsx)(l.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,t.jsxs)(g.Z,{direction:"row",spacing:1,children:[(0,t.jsx)(u.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),w.map(e=>(0,t.jsx)(c.Z,{size:"small",variant:"outlined",onClick:()=>_(e.template),children:e.label},e.label))]})}),(0,t.jsx)(v.Z,{}),(0,t.jsxs)(l.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,t.jsx)(d.Z,{inputRef:D,fullWidth:!0,size:"small",placeholder:"Enter command...",value:s,onChange:e=>i(e.target.value),onKeyDown:G,disabled:!N||M,InputProps:{sx:{fontFamily:"monospace"}}}),(0,t.jsx)(c.Z,{variant:"contained",onClick:K,disabled:!s.trim()||!N||M,startIcon:M?(0,t.jsx)(Z.Z,{size:16}):(0,t.jsx)(f.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},163:function(e,r,s){"use strict";s.d(r,{Y:function(){return i}});var t=s(35106),n=s(93757);function i(e){let{serverName:r,maxLines:s=500,enabled:i=!0,reconnectInterval:a=3e3}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{o([])},[r]);let d=(0,t.useCallback)(e=>{let r;"server-log"===e.type?r=e.data.log:"log"in e&&"string"==typeof e.log&&(r=e.log),r&&o(e=>{let t=[...e,r];return t.length>s?t.slice(t.length-s):t})},[s]),{isConnected:c,reconnect:x,retryCount:h}=(0,n.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/logs"),onMessage:d,enabled:i,reconnectInterval:a});return{logs:l,isConnected:c,clearLogs:(0,t.useCallback)(()=>{o([])},[]),reconnect:x,retryCount:h}}}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,540,6189,4840,5511,55,310,3543,8347,2149,4538,6645,9887,6594,2537,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[224],{49726:function(e,t,r){Promise.resolve().then(r.bind(r,7854))},7854:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return en}});var n=r(94655),s=r(35106),o=r(31358),i=r(7281),a=r(30417),l=r(81071),c=r(93017),u=r(69899),d=r(31317),h=r(76492),m=r(32366),p=r(78067),x=r(84840),f=r(97436),v=r(52082),y=r(89923),g=r(10297),S=r(42431),C=r(628),j=r(41565),b=r(25935),Z=r(79983),w=r(25333),k=r(95511),T=r(5501),q=r(93315),R=r(27171),I=r(96292);let E=e=>{switch(e){case"running":return"success";case"stopped":case"exited":case"not_created":return"error";case"created":return"warning";default:return"default"}},F=e=>{switch(e){case"running":return"Running";case"stopped":case"exited":return"Stopped";case"not_created":return"Not Created";case"created":return"Created";default:return e||"Unknown"}},N=e=>{if(!e)return"-";let t=e.split(",").map(e=>e.trim());return t.find(e=>e.endsWith(".local"))||t[0]||"-"};function O(e){var t;let{server:r,statusOverride:s,onClick:o,onStart:a,onStop:l,loading:c=!1}=e,u=(null==s?void 0:s.status)||r.status,h=(e,t)=>{e.stopPropagation(),t(r.name)},m="running"===u,p="stopped"===u||"exited"===u||"not_created"===u,x=N(r.hostname),f=(null===(t=r.hostname)||void 0===t?void 0:t.split(",").map(e=>e.trim()))||[];return(0,n.jsxs)(C.Z,{role:"article",onClick:()=>{o&&o(r.name)},sx:{cursor:o?"pointer":"default",transition:"all 0.2s",height:180,display:"flex",flexDirection:"column","&:hover":o?{transform:"translateY(-2px)",boxShadow:4}:{}},children:[(0,n.jsxs)(j.Z,{sx:{flex:1,pb:1},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,n.jsx)(d.Z,{variant:"h6",component:"h3",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,mr:1},children:r.name}),(0,n.jsx)(w.Z,{label:F(u),size:"small",color:E(u),sx:{fontWeight:500,minWidth:70}})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,n.jsx)(I.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(k.Z,{title:f.length>1?f.join("\n"):"",arrow:!0,children:(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[x,f.length>1&&" (+".concat(f.length-1,")")]})})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(R.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.container})]})]}),(0,n.jsxs)(b.Z,{sx:{justifyContent:"flex-end",px:2,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:[p&&a&&(0,n.jsx)(Z.Z,{"aria-label":"Start server",color:"success",onClick:e=>h(e,a),disabled:c,size:"small",children:(0,n.jsx)(T.Z,{})}),m&&l&&(0,n.jsx)(Z.Z,{"aria-label":"Stop server",color:"error",onClick:e=>h(e,l),disabled:c,size:"small",children:(0,n.jsx)(q.Z,{})}),!p&&!m&&(0,n.jsx)(i.Z,{sx:{height:34}})]})]})}function L(e){let{servers:t,statusMap:r={},onServerClick:o,onStart:l,onStop:c,onCreate:u,loadingServers:h=[]}=e,[p,C]=(0,s.useState)(""),[j,b]=(0,s.useState)("all"),Z=(0,s.useMemo)(()=>t.filter(e=>{if(p&&!e.name.toLowerCase().includes(p.toLowerCase()))return!1;let t=r[e.name],n=(null==t?void 0:t.status)||e.status;return("running"!==j||"running"===n)&&("stopped"!==j||"stopped"===n||"exited"===n||"not_created"===n)}),[t,r,p,j]);return 0===t.length?(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:2},children:[(0,n.jsx)(d.Z,{variant:"h6",color:"text.secondary",children:"No servers found"}),u&&(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(m.Z,{}),onClick:u,children:"Create Server"})]}):(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:3,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between"},children:[(0,n.jsxs)(g.Z,{value:j,exclusive:!0,onChange:(e,t)=>{null!==t&&b(t)},size:"small",sx:{flexShrink:0},children:[(0,n.jsx)(y.Z,{value:"all",children:"All"}),(0,n.jsx)(y.Z,{value:"running",children:"Running"}),(0,n.jsx)(y.Z,{value:"stopped",children:"Stopped"})]}),(0,n.jsx)(f.Z,{size:"small",placeholder:"Search servers...",value:p,onChange:e=>C(e.target.value),InputProps:{startAdornment:(0,n.jsx)(v.Z,{position:"start",children:(0,n.jsx)(S.Z,{})})},sx:{flexGrow:{xs:1,sm:0},minWidth:{sm:300}}})]}),(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:[Z.length," ",1===Z.length?"server":"servers"]}),0===Z.length?(0,n.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:(0,n.jsx)(d.Z,{variant:"h6",color:"text.secondary",children:"No servers found"})}):(0,n.jsx)(x.ZP,{container:!0,spacing:2,children:Z.map(e=>(0,n.jsx)(x.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,n.jsx)(O,{server:e,statusOverride:r[e.name],onClick:o,onStart:l,onStop:c,loading:h.includes(e.name)})},e.name))})]})}var P=r(99770),D=r(62508),K=r(5682),M=r(76678),A=r(7178),Q=r(40064),W=r(45547),U=r(4405),z=r(73383),_=r(82285),G=r(13609),H=r(46207),J=r(43436),V=r(87716);let $=["VANILLA","PAPER","FABRIC","FORGE","NEOFORGE"],B=["","forge","fabric","neoforge","quilt"],Y={name:"",type:"PAPER",version:"1.21.1",memory:"4G",autoStart:!1,sudoPassword:""},X=[{key:"initializing",label:"Initializing"},{key:"creating",label:"Creating"},{key:"configuring",label:"Configuring"},{key:"starting",label:"Starting"}];function ee(e){let t,{open:r,onClose:o,onSubmit:u,loading:h=!1,status:m="idle",progress:p=0,message:x=""}=e,[v,S]=(0,s.useState)("standard"),[C,j]=(0,s.useState)(Y),[b,Z]=(0,s.useState)({}),[w,k]=(0,s.useState)(!1),T=(0,s.useRef)(null),q=(0,s.useRef)(null),R=X.findIndex(e=>e.key===m),I="idle"!==m&&"completed"!==m&&"error"!==m;(0,s.useEffect)(()=>{r||(S("standard"),j(Y),Z({}),k(!1))},[r]);let E=e=>e?/^[a-z0-9-]+$/.test(e)?null:"Only lowercase letters, numbers, and hyphens are allowed":"Server name is required",F=e=>e?null:"Modpack slug is required",N=e=>t=>{let r=t.target.value;j(t=>({...t,[e]:r})),"memory"===e&&k(!0),b[e]&&Z(t=>({...t,[e]:""}))};return(0,n.jsx)(P.Z,{open:r,onClose:I?void 0:o,maxWidth:"sm",fullWidth:!0,children:(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),Z({});let t=E(C.name);if(t){Z({name:t});return}if("modpack"===v){let e=F(C.modpack||"");if(e){Z({modpack:e});return}}let r={name:C.name,memory:C.memory,autoStart:C.autoStart,sudoPassword:C.sudoPassword};"standard"===v?(r.type=C.type,r.version=C.version):(r.type="MODRINTH",r.modpack=C.modpack,r.modpackVersion=C.modpackVersion||"",r.modLoader=C.modLoader||""),u(r)},children:[(0,n.jsx)(D.Z,{children:"completed"===m?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(H.Z,{color:"success"}),"Server Created Successfully"]}):"error"===m?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(J.Z,{color:"error"}),"Creation Failed"]}):"Create New Server"}),(0,n.jsx)(K.Z,{children:I||"completed"===m||"error"===m?(0,n.jsxs)(i.Z,{sx:{py:2},children:[(0,n.jsx)(z.Z,{activeStep:R,alternativeLabel:!0,sx:{mb:3},children:X.map(e=>(0,n.jsx)(_.Z,{children:(0,n.jsx)(G.Z,{children:e.label})},e.key))}),I&&(0,n.jsxs)(i.Z,{sx:{mb:3},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:x}),(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",children:[p,"%"]})]}),(0,n.jsx)(U.Z,{variant:"determinate",value:p})]}),"completed"===m&&(0,n.jsx)(d.Z,{color:"success.main",sx:{textAlign:"center"},children:x}),"error"===m&&(0,n.jsx)(d.Z,{color:"error.main",sx:{textAlign:"center"},children:x})]}):(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[(0,n.jsx)(i.Z,{ref:q,role:"status","aria-live":"polite",sx:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"}}),(0,n.jsx)(f.Z,{label:"Server Name",value:C.name,onChange:N("name"),error:!!b.name,helperText:b.name||"Only lowercase letters, numbers, and hyphens",fullWidth:!0,autoFocus:!0,disabled:I}),(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,n.jsx)(d.Z,{variant:"subtitle2",color:"text.secondary",children:"Server Type"}),(0,n.jsxs)(g.Z,{value:v,exclusive:!0,onChange:(e,t)=>{null!==t&&(S(t),q.current&&(q.current.textContent="".concat("standard"===t?"Standard Server":"Modpack"," category selected")),w||j(e=>({...e,memory:"standard"===t?"4G":"6G"})),setTimeout(()=>{"modpack"===t&&T.current&&T.current.focus()},300))},"aria-label":"Server category",fullWidth:!0,disabled:I,children:[(0,n.jsx)(y.Z,{value:"standard","aria-label":"Standard Server",children:"Standard Server"}),(0,n.jsx)(y.Z,{value:"modpack","aria-label":"Modpack",children:"Modpack"})]}),(0,n.jsx)(V.Z,{in:"standard"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(f.Z,{label:"Server Type",select:!0,value:C.type,onChange:N("type"),fullWidth:!0,disabled:I,children:$.map(e=>(0,n.jsx)(A.Z,{value:e,children:e},e))}),(0,n.jsx)(f.Z,{label:"Minecraft Version",value:C.version,onChange:N("version"),helperText:"e.g., 1.21.1, 1.20.4, latest",fullWidth:!0,disabled:I})]})}),(0,n.jsx)(V.Z,{in:"modpack"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(l.Z,{severity:"info",children:"Minecraft version is automatically determined by the modpack"}),(0,n.jsx)(f.Z,{label:"Modpack Slug",value:C.modpack||"",onChange:N("modpack"),error:!!b.modpack,helperText:b.modpack||"e.g., cobblemon, adrenaserver (from modrinth.com/modpacks/SLUG)",fullWidth:!0,disabled:I,inputRef:T}),(0,n.jsxs)(f.Z,{label:"Mod Loader",select:!0,value:C.modLoader||"",onChange:N("modLoader"),helperText:"Leave empty to auto-detect from modpack",fullWidth:!0,disabled:I,children:[(0,n.jsx)(A.Z,{value:"",children:"Auto-detect"}),B.filter(e=>e).map(e=>(0,n.jsx)(A.Z,{value:e,children:e},e))]}),(0,n.jsx)(f.Z,{label:"Modpack Version",value:C.modpackVersion||"",onChange:N("modpackVersion"),helperText:"Leave empty for latest",fullWidth:!0,disabled:I})]})})]}),(0,n.jsx)(f.Z,{label:"Memory",value:C.memory,onChange:N("memory"),helperText:"e.g., 4G, 8G, 16G",fullWidth:!0,disabled:I}),(0,n.jsx)(f.Z,{label:"Sudo Password",type:"password",value:C.sudoPassword||"",onChange:N("sudoPassword"),helperText:"Required for mDNS hostname registration (avahi)",fullWidth:!0,disabled:I}),(0,n.jsx)(Q.Z,{control:(0,n.jsx)(W.Z,{checked:C.autoStart||!1,onChange:(t="autoStart",e=>{j(r=>({...r,[t]:e.target.checked}))}),disabled:I}),label:"Auto-start after creation"})]})}),(0,n.jsx)(M.Z,{sx:{px:3,pb:2},children:"completed"===m||"error"===m?(0,n.jsx)(a.Z,{onClick:o,variant:"contained",fullWidth:!0,children:"Close"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Z,{onClick:o,disabled:I,children:"Cancel"}),(0,n.jsx)(a.Z,{type:"submit",variant:"contained",disabled:I,startIcon:I?(0,n.jsx)(c.Z,{size:16}):null,children:I?"Creating...":"Create"})]})})]})})}var et=r(92666),er=r(59104);function en(){var e,t;let r=(0,o.x)(),[x,f]=(0,s.useState)(!1),[v,y]=(0,s.useState)([]),{data:g,isLoading:S,error:C}=(0,et.x$)(),{statusMap:j}=(0,er.d)(),b=(0,et.jM)(),Z=(0,et.Aw)(),w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onSuccess:t,onError:r,onProgress:n}=e,[o,i]=(0,s.useState)("idle"),[a,l]=(0,s.useState)(0),[c,u]=(0,s.useState)(""),[d,h]=(0,s.useState)(null),m=(0,s.useRef)(null),p=(0,s.useRef)(""),x=(0,s.useCallback)(()=>{i("idle"),l(0),u(""),h(null),m.current&&(m.current.close(),m.current=null)},[]),f=(0,s.useCallback)((e,t,r)=>{i(e),u(t),l(r),null==n||n(e,t,r)},[n]),v=(0,s.useCallback)(async e=>{if("idle"===o||"completed"===o||"error"===o){h(null),f("initializing","Initializing server creation...",0),p.current=e.name,m.current&&m.current.close();try{let r=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.text();throw Error(e||"Server creation failed: ".concat(r.statusText))}await r.json(),f("creating","Creating server configuration...",25),await new Promise(e=>setTimeout(e,500)),f("configuring","Configuring Docker compose...",50),await new Promise(e=>setTimeout(e,500)),f("starting","Starting server container...",75),await new Promise(e=>setTimeout(e,500)),f("completed","Server created successfully!",100),null==t||t(e.name)}catch(t){let e=t instanceof Error?t.message:"Unknown error occurred";i("error"),h(e),u("Server creation failed"),null==r||r(e)}}},[o,f,t,r]);return(0,s.useEffect)(()=>()=>{m.current&&(m.current.close(),m.current=null)},[]),{status:o,progress:a,message:c,error:d,isCreating:"idle"!==o&&"completed"!==o&&"error"!==o,createServer:v,reset:x}}({onSuccess:()=>{f(!1)},onError:e=>{console.error("Failed to create server:",e)}}),k=async e=>{y(t=>[...t,e]);try{await b.mutateAsync(e)}catch(e){console.error("Failed to start server:",e)}finally{y(t=>t.filter(t=>t!==e))}},T=async e=>{y(t=>[...t,e]);try{await Z.mutateAsync(e)}catch(e){console.error("Failed to stop server:",e)}finally{y(t=>t.filter(t=>t!==e))}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,h.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,h.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,h.Fq)(e.palette.info.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,n.jsx)(p.Z,{sx:{fontSize:32}})}),(0,n.jsxs)(i.Z,{children:[(0,n.jsx)(d.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Servers"}),(0,n.jsx)(d.Z,{variant:"body1",color:"text.secondary",children:"Manage your Minecraft servers"})]})]}),(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(m.Z,{}),onClick:()=>f(!0),size:"large",children:"Create Server"})]}),C&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to load servers: ",C.message]}),w.error&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to create server: ",w.error]}),b.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=b.error)||void 0===e?void 0:e.message]}),Z.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=Z.error)||void 0===t?void 0:t.message]}),S?(0,n.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,n.jsx)(c.Z,{})}):(0,n.jsx)(L,{servers:(null==g?void 0:g.servers)||[],statusMap:j,onServerClick:e=>{r.push("/servers/".concat(encodeURIComponent(e)))},onStart:k,onStop:T,onCreate:()=>f(!0),loadingServers:v}),(0,n.jsx)(ee,{open:x,onClose:()=>{f(!1),w.reset()},onSubmit:e=>{w.createServer(e)},loading:w.isCreating,status:w.status,progress:w.progress,message:w.message})]})}},3454:function(e,t,r){"use strict";r.d(t,{LoadingProvider:function(){return l},startLoading:function(){return c},stopLoading:function(){return u}});var n=r(94655),s=r(35106),o=r(74228),i=r(31477),a=r.n(i);function l(e){let{children:t}=e,r=(0,o.usePathname)(),i=(0,o.useSearchParams)();return(0,s.useEffect)(()=>{a().done()},[r,i]),(0,n.jsx)(n.Fragment,{children:t})}function c(){a().start()}function u(){a().done()}a().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,r){"use strict";r.d(t,{Av:function(){return n.startLoading}});var n=r(3454)},42936:function(e,t,r){"use strict";async function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={...t.headers};t.body&&(r["Content-Type"]="application/json");let n=await fetch(e,{...t,headers:r});if(!n.ok){let e=await n.json().catch(()=>({error:"UnknownError",message:n.statusText})),t=Error(e.message);throw t.statusCode=n.status,t.code=e.error,t}return n.json()}r.d(t,{SC:function(){return n}})},31358:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var n=r(74228),s=r(35106),o=r(8690);function i(){let e=(0,n.useRouter)(),t=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.push(t,r)},[e]),r=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.replace(t,r)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:r}),[e,t,r])}},92666:function(e,t,r){"use strict";r.d(t,{$t:function(){return b},Aw:function(){return d},Fv:function(){return v},Hq:function(){return c},Hy:function(){return l},MH:function(){return g},Sr:function(){return m},_I:function(){return h},c5:function(){return Z},g2:function(){return f},gx:function(){return S},hy:function(){return p},iC:function(){return y},jM:function(){return u},mj:function(){return j},nq:function(){return x},nv:function(){return C},s8:function(){return w},x$:function(){return a}});var n=r(5632),s=r(58919),o=r(20367),i=r(42936);function a(){return(0,n.a)({queryKey:["servers"],queryFn:()=>(0,i.SC)("/api/servers"),refetchInterval:6e4})}function l(e,t){return(0,n.a)({queryKey:["servers",e],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{name:t,force:r}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(t)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function u(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function d(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function h(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function m(){return(0,n.a)({queryKey:["worlds"],queryFn:()=>(0,i.SC)("/api/worlds"),refetchInterval:3e4})}function p(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function x(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{worldName:t,serverName:r}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(t),"/assign"),{method:"POST",body:JSON.stringify({serverName:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function f(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{worldName:t,force:r}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(t),"/release").concat(r?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function v(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{name:t,force:r}=e;return(0,i.SC)("/api/worlds/".concat(encodeURIComponent(t)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function y(e,t){return(0,n.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function g(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{serverName:t,config:r}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(t),"/config"),{method:"PATCH",body:JSON.stringify(r)})},onSuccess:(t,r)=>{let{serverName:n}=r;e.invalidateQueries({queryKey:["servers",n,"config"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function S(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["servers",r]}),e.invalidateQueries({queryKey:["worlds"]})}})}function C(){return(0,n.a)({queryKey:["router-status"],queryFn:()=>(0,i.SC)("/api/router/status"),refetchInterval:3e4})}function j(){return(0,n.a)({queryKey:["backup-status"],queryFn:()=>(0,i.SC)("/api/backup"),refetchInterval:6e4})}function b(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,n.a)({queryKey:["backup-history",e],queryFn:()=>(0,i.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function Z(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>{let{message:t}=e;return(0,i.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function w(){let e=(0,s.NL)();return(0,o.D)({mutationFn:e=>(0,i.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}},93757:function(e,t,r){"use strict";r.d(t,{D:function(){return o}});var n=r(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,r;let n=JSON.parse(e.data);null===(r=this.options)||void 0===r||null===(t=r.onMessage)||void 0===t||t.call(r,n)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let r={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=r,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,r),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let r=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=r)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let n=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},n)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,r;this.state=e,null===(r=this.options)||void 0===r||null===(t=r.onStateChange)||void 0===t||t.call(r,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function o(e){let{url:t,onMessage:r,onError:o,reconnectInterval:i=3e3,maxReconnectAttempts:a=1/0,enabled:l=!0,withCredentials:c=!1}=e,[u,d]=(0,n.useState)(null),[h,m]=(0,n.useState)("disconnected"),[p,x]=(0,n.useState)(null),[f,v]=(0,n.useState)(0),y=(0,n.useRef)(null),g=(0,n.useCallback)(e=>{d(e),null==r||r(e)},[r]),S=(0,n.useCallback)(e=>{m(e),"connected"===e&&v(0)},[]),C=(0,n.useCallback)(e=>{x(e),"number"==typeof e.retryCount&&v(e.retryCount),null==o||o(e)},[o]),j=(0,n.useCallback)(()=>{y.current&&(y.current.reconnect(),v(y.current.getRetryCount()))},[]),b=(0,n.useCallback)(()=>{y.current&&y.current.disconnect()},[]);return(0,n.useEffect)(()=>{if(!l){y.current&&(y.current.disconnect(),y.current=null);return}return y.current||(y.current=new s),y.current.connect({url:t,onMessage:g,onStateChange:S,onError:C,reconnectInterval:i,maxReconnectAttempts:a,withCredentials:c}),()=>{y.current&&(y.current.disconnect(),y.current=null)}},[t,l,i,a,c,g,S,C]),{data:u,isConnected:"connected"===h,state:h,error:p,retryCount:f,reconnect:j,disconnect:b}}},59104:function(e,t,r){"use strict";r.d(t,{d:function(){return o}});var n=r(35106),s=r(93757);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:r=!0,reconnectInterval:o=3e3}=e,[i,a]=(0,n.useState)({}),l=(0,n.useCallback)(e=>{if("server-status"===e.type){let{serverName:r,status:n,health:s,timestamp:o}=e.data;a(e=>({...e,[r]:{status:n,health:s,timestamp:o}})),null==t||t(r,n,s)}},[t]),{isConnected:c,reconnect:u,retryCount:d}=(0,s.D)({url:"/api/sse/servers-status",onMessage:l,enabled:r,reconnectInterval:o}),h=(0,n.useCallback)(e=>i[e]||null,[i]);return(0,n.useEffect)(()=>{r||a({})},[r]),{statusMap:i,getServerStatus:h,isConnected:c,reconnect:u,retryCount:d}}}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,540,6189,4840,5511,310,3543,4538,4278,9887,7413,3669,2757,1744],function(){return e(e.s=49726)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7701],{6199:function(e,n,r){Promise.resolve().then(r.bind(r,36405))},36405:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return E}});var t=r(94655),s=r(35106),i=r(7281),l=r(30417),o=r(81071),a=r(93017),c=r(69899),d=r(31317),u=r(99770),x=r(62508),h=r(5682),m=r(76678),f=r(97436),y=r(76492),v=r(32366),p=r(84974),j=r(84840),g=r(52082),Z=r(89923),b=r(10297),S=r(42431),C=r(628),w=r(41565),q=r(25935),k=r(79983),I=r(25333),F=r(95511),D=r(96292),L=r(97812),K=r(21111),N=r(78067),W=r(33104);function T(e){let{world:n,onAssign:r,onRelease:s,onDelete:l,loading:o=!1}=e,a=(e,r)=>{e.stopPropagation(),r(n.name)};return(0,t.jsxs)(C.Z,{role:"article",sx:{transition:"all 0.2s",height:200,display:"flex",flexDirection:"column","&:hover":{transform:"translateY(-2px)",boxShadow:4}},children:[(0,t.jsxs)(w.Z,{sx:{flex:1,pb:1},children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(d.Z,{variant:"h6",component:"h3",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,mr:1},children:n.name}),(0,t.jsx)(I.Z,{label:n.isLocked?"Locked":"Available",size:"small",color:n.isLocked?"warning":"success",sx:{fontWeight:500,minWidth:80}})]}),(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,t.jsx)(N.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,t.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:n.size||"Unknown size"})]}),n.isLocked&&n.lockedBy&&(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,t.jsx)(D.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,t.jsx)(F.Z,{title:"Assigned to ".concat(n.lockedBy),arrow:!0,children:(0,t.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.lockedBy})})]}),(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(W.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,t.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:(e=>{if(!e)return"-";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch(n){return e}})(n.lastModified)})]})]}),(0,t.jsxs)(q.Z,{sx:{justifyContent:"flex-end",px:2,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:[!n.isLocked&&r&&(0,t.jsx)(F.Z,{title:"Assign to server",arrow:!0,children:(0,t.jsx)(k.Z,{"aria-label":"Assign world",color:"primary",onClick:e=>a(e,r),disabled:o,size:"small",children:(0,t.jsx)(D.Z,{})})}),n.isLocked&&s&&(0,t.jsx)(F.Z,{title:"Release from server",arrow:!0,children:(0,t.jsx)(k.Z,{"aria-label":"Release world",color:"warning",onClick:e=>a(e,s),disabled:o,size:"small",children:(0,t.jsx)(L.Z,{})})}),l&&(0,t.jsx)(F.Z,{title:"Delete world",arrow:!0,children:(0,t.jsx)(k.Z,{"aria-label":"Delete world",color:"error",onClick:e=>a(e,l),disabled:o,size:"small",children:(0,t.jsx)(K.Z,{})})})]})]})}function O(e){let{worlds:n,onAssign:r,onRelease:o,onDelete:a,onCreate:c,loadingWorlds:u=[]}=e,[x,h]=(0,s.useState)(""),[m,y]=(0,s.useState)("all"),p=(0,s.useMemo)(()=>n.filter(e=>(!x||!!e.name.toLowerCase().includes(x.toLowerCase()))&&("available"!==m||!e.isLocked)&&("locked"!==m||!!e.isLocked)),[n,x,m]);return 0===n.length?(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:2},children:[(0,t.jsx)(d.Z,{variant:"h6",color:"text.secondary",children:"No worlds found"}),c&&(0,t.jsx)(l.Z,{variant:"contained",startIcon:(0,t.jsx)(v.Z,{}),onClick:c,children:"Create World"})]}):(0,t.jsxs)(i.Z,{children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:3,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between"},children:[(0,t.jsxs)(b.Z,{value:m,exclusive:!0,onChange:(e,n)=>{null!==n&&y(n)},size:"small",sx:{flexShrink:0},children:[(0,t.jsx)(Z.Z,{value:"all",children:"All"}),(0,t.jsx)(Z.Z,{value:"available",children:"Available"}),(0,t.jsx)(Z.Z,{value:"locked",children:"Locked"})]}),(0,t.jsx)(f.Z,{size:"small",placeholder:"Search worlds...",value:x,onChange:e=>h(e.target.value),InputProps:{startAdornment:(0,t.jsx)(g.Z,{position:"start",children:(0,t.jsx)(S.Z,{})})},sx:{flexGrow:{xs:1,sm:0},minWidth:{sm:300}}})]}),(0,t.jsxs)(d.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:[p.length," ",1===p.length?"world":"worlds"]}),0===p.length?(0,t.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:(0,t.jsx)(d.Z,{variant:"h6",color:"text.secondary",children:"No worlds found"})}):(0,t.jsx)(j.ZP,{container:!0,spacing:2,children:p.map(e=>(0,t.jsx)(j.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,t.jsx)(T,{world:e,onAssign:r,onRelease:o,onDelete:a,loading:u.includes(e.name)})},e.name))})]})}let P={name:"",seed:""};function Q(e){let{open:n,onClose:r,onSubmit:o,loading:c=!1}=e,[d,y]=(0,s.useState)(P),[v,p]=(0,s.useState)({});(0,s.useEffect)(()=>{n||(y(P),p({}))},[n]);let j=e=>e?/^[a-z0-9-]+$/.test(e)?null:"Only lowercase letters, numbers, and hyphens are allowed":"World name is required",g=e=>n=>{let r=n.target.value;y(n=>({...n,[e]:r})),v[e]&&p(n=>({...n,[e]:""}))};return(0,t.jsx)(u.Z,{open:n,onClose:c?void 0:r,maxWidth:"sm",fullWidth:!0,children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p({});let n=j(d.name);if(n){p({name:n});return}o({name:d.name,...d.seed?{seed:d.seed}:{}})},children:[(0,t.jsx)(x.Z,{children:"Create New World"}),(0,t.jsx)(h.Z,{children:(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[(0,t.jsx)(f.Z,{label:"World Name",value:d.name,onChange:g("name"),error:!!v.name,helperText:v.name||"Only lowercase letters, numbers, and hyphens",fullWidth:!0,autoFocus:!0,disabled:c}),(0,t.jsx)(f.Z,{label:"Seed (optional)",value:d.seed||"",onChange:g("seed"),helperText:"Leave empty for a random seed",fullWidth:!0,disabled:c})]})}),(0,t.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:r,disabled:c,children:"Cancel"}),(0,t.jsx)(l.Z,{type:"submit",variant:"contained",disabled:c,startIcon:c?(0,t.jsx)(a.Z,{size:16}):null,children:c?"Creating...":"Create"})]})]})})}var R=r(7178),z=r(92666);function A(e){let{open:n,worldName:r,onClose:c,onSubmit:y,loading:v=!1}=e,[p,j]=(0,s.useState)(""),{data:g,isLoading:Z}=(0,z.x$)();(0,s.useEffect)(()=>{n||j("")},[n]);let b=(null==g?void 0:g.servers)||[],S=b.filter(e=>"running"!==e.status),C=b.filter(e=>"running"===e.status);return(0,t.jsx)(u.Z,{open:n,onClose:v?void 0:c,maxWidth:"sm",fullWidth:!0,children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p&&y(r,p)},children:[(0,t.jsxs)(x.Z,{children:["Assign World: ",r]}),(0,t.jsx)(h.Z,{children:(0,t.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:Z?(0,t.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(a.Z,{})}):0===b.length?(0,t.jsx)(d.Z,{color:"text.secondary",children:"No servers available. Create a server first."}):(0,t.jsxs)(t.Fragment,{children:[0===S.length&&C.length>0&&(0,t.jsx)(o.Z,{severity:"warning",children:"All servers are currently running. It is recommended to assign worlds to stopped servers."}),(0,t.jsxs)(f.Z,{label:"Select Server",select:!0,value:p,onChange:e=>j(e.target.value),fullWidth:!0,disabled:v,helperText:"Select a server to assign this world to",children:[S.length>0&&(0,t.jsx)(R.Z,{disabled:!0,children:(0,t.jsx)(d.Z,{variant:"caption",color:"text.secondary",children:"Available Servers"})}),S.map(e=>(0,t.jsx)(R.Z,{value:e.name,children:e.name},e.name)),C.length>0&&(0,t.jsx)(R.Z,{disabled:!0,children:(0,t.jsx)(d.Z,{variant:"caption",color:"text.secondary",children:"Running Servers (not recommended)"})}),C.map(e=>(0,t.jsx)(R.Z,{value:e.name,children:e.name},e.name))]})]})})}),(0,t.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:c,disabled:v,children:"Cancel"}),(0,t.jsx)(l.Z,{type:"submit",variant:"contained",disabled:v||!p||Z,startIcon:v?(0,t.jsx)(a.Z,{size:16}):null,children:v?"Assigning...":"Assign"})]})]})})}function E(){var e,n,r,j;let[g,Z]=(0,s.useState)(!1),[b,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),[q,k]=(0,s.useState)(""),[I,F]=(0,s.useState)([]),{data:D,isLoading:L,error:K}=(0,z.Sr)(),N=(0,z.hy)(),W=(0,z.nq)(),T=(0,z.g2)(),P=(0,z.Fv)(),R=async e=>{F(n=>[...n,e]);try{await T.mutateAsync({worldName:e})}catch(e){console.error("Failed to release world:",e)}finally{F(n=>n.filter(n=>n!==e))}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,y.Fq)(e.palette.success.main,.1)," 0%, ").concat((0,y.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,y.Fq)(e.palette.success.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"success.main",color:"success.contrastText"},children:(0,t.jsx)(p.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(d.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Worlds"}),(0,t.jsx)(d.Z,{variant:"body1",color:"text.secondary",children:"Manage your Minecraft worlds"})]})]}),(0,t.jsx)(l.Z,{variant:"contained",startIcon:(0,t.jsx)(v.Z,{}),onClick:()=>Z(!0),size:"large",children:"Create World"})]}),K&&(0,t.jsxs)(o.Z,{severity:"error",sx:{mb:3},children:["Failed to load worlds: ",K.message]}),N.isError&&(0,t.jsxs)(o.Z,{severity:"error",sx:{mb:3},children:["Failed to create world: ",null===(e=N.error)||void 0===e?void 0:e.message]}),W.isError&&(0,t.jsxs)(o.Z,{severity:"error",sx:{mb:3},children:["Failed to assign world: ",null===(n=W.error)||void 0===n?void 0:n.message]}),T.isError&&(0,t.jsxs)(o.Z,{severity:"error",sx:{mb:3},children:["Failed to release world: ",null===(r=T.error)||void 0===r?void 0:r.message]}),P.isError&&(0,t.jsxs)(o.Z,{severity:"error",sx:{mb:3},children:["Failed to delete world: ",null===(j=P.error)||void 0===j?void 0:j.message]}),L?(0,t.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(a.Z,{})}):(0,t.jsx)(O,{worlds:(null==D?void 0:D.worlds)||[],onAssign:e=>S(e),onRelease:R,onDelete:e=>{w(e),k("")},onCreate:()=>Z(!0),loadingWorlds:I}),(0,t.jsx)(Q,{open:g,onClose:()=>{Z(!1),N.reset()},onSubmit:e=>{N.mutate(e,{onSuccess:()=>{Z(!1)}})},loading:N.isPending}),(0,t.jsx)(A,{open:!!b,worldName:b||"",onClose:()=>S(null),onSubmit:(e,n)=>{F(n=>[...n,e]),W.mutate({worldName:e,serverName:n},{onSuccess:()=>{S(null)},onSettled:()=>{F(n=>n.filter(n=>n!==e))}})},loading:W.isPending}),(0,t.jsxs)(u.Z,{open:!!C,onClose:()=>{w(null),k("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(x.Z,{children:"Delete World"}),(0,t.jsxs)(h.Z,{children:[(0,t.jsxs)(d.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:C})," to confirm deletion."]}),(0,t.jsx)(f.Z,{label:"World name",value:q,onChange:e=>k(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:()=>{w(null),k("")},children:"Cancel"}),(0,t.jsx)(l.Z,{variant:"contained",color:"error",onClick:()=>{C&&q===C&&(F(e=>[...e,C]),P.mutate({name:C,force:!0},{onSuccess:()=>{w(null),k("")},onSettled:()=>{F(e=>e.filter(e=>e!==C))}}))},disabled:q!==C||P.isPending,startIcon:P.isPending?(0,t.jsx)(a.Z,{size:16}):null,children:P.isPending?"Deleting...":"Delete"})]})]})]})}},42936:function(e,n,r){"use strict";async function t(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={...n.headers};n.body&&(r["Content-Type"]="application/json");let t=await fetch(e,{...n,headers:r});if(!t.ok){let e=await t.json().catch(()=>({error:"UnknownError",message:t.statusText})),n=Error(e.message);throw n.statusCode=t.status,n.code=e.error,n}return t.json()}r.d(n,{SC:function(){return t}})},92666:function(e,n,r){"use strict";r.d(n,{$t:function(){return S},Aw:function(){return u},Fv:function(){return v},Hq:function(){return c},Hy:function(){return a},MH:function(){return j},Sr:function(){return h},_I:function(){return x},c5:function(){return C},g2:function(){return y},gx:function(){return g},hy:function(){return m},iC:function(){return p},jM:function(){return d},mj:function(){return b},nq:function(){return f},nv:function(){return Z},s8:function(){return w},x$:function(){return o}});var t=r(5632),s=r(58919),i=r(20367),l=r(42936);function o(){return(0,t.a)({queryKey:["servers"],queryFn:()=>(0,l.SC)("/api/servers"),refetchInterval:6e4})}function a(e,n){return(0,t.a)({queryKey:["servers",e],queryFn:()=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:r}=e;return(0,l.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function d(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function u(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function x(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function h(){return(0,t.a)({queryKey:["worlds"],queryFn:()=>(0,l.SC)("/api/worlds"),refetchInterval:3e4})}function m(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,serverName:r}=e;return(0,l.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function y(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,force:r}=e;return(0,l.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(r?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function v(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:r}=e;return(0,l.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(r?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function p(e,n){return(0,t.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function j(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:n,config:r}=e;return(0,l.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(r)})},onSuccess:(n,r)=>{let{serverName:t}=r;e.invalidateQueries({queryKey:["servers",t,"config"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function g(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,r)=>{e.invalidateQueries({queryKey:["servers",r]}),e.invalidateQueries({queryKey:["worlds"]})}})}function Z(){return(0,t.a)({queryKey:["router-status"],queryFn:()=>(0,l.SC)("/api/router/status"),refetchInterval:3e4})}function b(){return(0,t.a)({queryKey:["backup-status"],queryFn:()=>(0,l.SC)("/api/backup"),refetchInterval:6e4})}function S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,t.a)({queryKey:["backup-history",e],queryFn:()=>(0,l.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function C(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{message:n}=e;return(0,l.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function w(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,l.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,540,6189,4840,5511,310,3543,4278,315,3669,2757,1744],function(){return e(e.s=6199)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{40527:function(e,r,t){Promise.resolve().then(t.bind(t,10672))},628:function(e,r,t){"use strict";t.d(r,{Z:function(){return Z}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(69899),c=t(11379),h=t(9049);function m(e){return(0,h.ZP)("MuiCard",e)}(0,c.Z)("MuiCard",["root"]);var x=t(94655);let p=["className","raised"],f=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},m,r)},g=(0,o.ZP)(u.Z,{name:"MuiCard",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({overflow:"hidden"}));var Z=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCard"}),{className:s,raised:l=!1}=t,o=(0,i.Z)(t,p),u=(0,n.Z)({},t,{raised:l}),c=f(u);return(0,x.jsx)(g,(0,n.Z)({className:(0,a.Z)(c.root,s),elevation:l?8:void 0,ref:r,ownerState:u},o))})},41565:function(e,r,t){"use strict";t.d(r,{Z:function(){return g}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(11379),c=t(9049);function h(e){return(0,c.ZP)("MuiCardContent",e)}(0,u.Z)("MuiCardContent",["root"]);var m=t(94655);let x=["className","component"],p=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},h,r)},f=(0,o.ZP)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}}));var g=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCardContent"}),{className:s,component:l="div"}=t,o=(0,i.Z)(t,x),u=(0,n.Z)({},t,{component:l}),c=p(u);return(0,m.jsx)(f,(0,n.Z)({as:l,className:(0,a.Z)(c.root,s),ownerState:u,ref:r},o))})},10672:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return m}});var n=t(94655),i=t(74228),s=t(67337),a=t(7281),l=t(628),o=t(41565),d=t(31317),u=t(41261),c=t(85480),h=t(46725);function m(){let e=(0,i.useRouter)();return(0,n.jsx)(s.Z,{maxWidth:"sm",children:(0,n.jsx)(a.Z,{sx:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",py:4},children:(0,n.jsx)(l.Z,{sx:{width:"100%",maxWidth:500},children:(0,n.jsxs)(o.Z,{sx:{p:4},children:[(0,n.jsx)(d.Z,{variant:"h4",component:"h1",gutterBottom:!0,sx:{fontWeight:600,textAlign:"center",mb:3},children:"Welcome Back"}),(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",mb:4},children:"Sign in to manage your Minecraft servers"}),(0,n.jsx)(c.U0,{onSuccess:()=>{e.push("/dashboard")}}),(0,n.jsx)(a.Z,{sx:{mt:3,textAlign:"center"},children:(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",children:["Don't have an account?"," ",(0,n.jsx)(u.Z,{component:h.default,href:"/signup",underline:"hover",children:"Sign up"})]})})]})})})})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return x},WS:function(){return p},Ie:function(){return k}});var n=t(94655),i=t(35106),s=t(7281),a=t(56877),l=t(97436),o=t(52082),d=t(79983),u=t(30417),c=t(36848),h=t(554),m=t(6986);function x(e){let{onSuccess:r}=e,[t,x]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(!1),[v,j]=(0,i.useState)({}),[y,b]=(0,i.useState)(null),[w,C]=(0,i.useState)(!1),S=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),j(e),0===Object.keys(e).length},P=async e=>{if(e.preventDefault(),b(null),S()){C(!0);try{let e=await m.zB.email({email:t,password:p});if(e.error){b(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){b("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:P,sx:{display:"flex",flexDirection:"column",gap:2},children:[y&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>b(null),children:y}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>x(e.target.value),error:!!v.email,helperText:v.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!v.password,helperText:v.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!g)},edge:"end",children:g?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,x]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(""),[v,j]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[S,P]=(0,i.useState)({}),[k,W]=(0,i.useState)(null),[I,R]=(0,i.useState)(!1),q=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",v?g!==v&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",P(e),0===Object.keys(e).length},E=async e=>{if(e.preventDefault(),W(null),q()){R(!0);try{let e=await m.y1.email({email:p,password:g,name:t});if(e.error){W(e.error.message||"Registration failed"),R(!1);return}r&&r()}catch(e){W("An unexpected error occurred. Please try again."),R(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:E,sx:{display:"flex",flexDirection:"column",gap:2},children:[k&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>W(null),children:k}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>x(e.target.value),error:!!S.name,helperText:S.name,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!S.email,helperText:S.email,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:y?"text":"password",value:g,onChange:e=>Z(e.target.value),error:!!S.password,helperText:S.password,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!y)},edge:"end",children:y?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:v,onChange:e=>j(e.target.value),error:!!S.confirmPassword,helperText:S.confirmPassword,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:I,fullWidth:!0,size:"large",children:I?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),Z=t(86702),v=t(35694),j=t(31317),y=t(25333),b=t(69123),w=t(7178),C=t(17820),S=t(73424),P=t(78319);function k(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,m.kP)(),[a,l]=(0,i.useState)(null),o=()=>{l(null)},c=async()=>{o(),await (0,m.w7)(),e.push("/login")};if(t)return(0,n.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(u.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:h}=r,x=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(h.name,h.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(Z.Z,{sx:{bgcolor:"primary.main"},children:x})}),(0,n.jsxs)(v.Z,{anchorEl:a,open:!!a,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(s.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(j.Z,{variant:"subtitle1",fontWeight:"600",children:h.name||"User"}),(0,n.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:h.email}),"admin"===h.role&&(0,n.jsx)(y.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(b.Z,{}),(0,n.jsxs)(w.Z,{onClick:c,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(P.Z,{fontSize:"small"})}),(0,n.jsx)(S.Z,{children:"Logout"})]})]})]})}},6986:function(e,r,t){"use strict";t.d(r,{kP:function(){return d},w7:function(){return l},y1:function(){return o},zB:function(){return a}});var n=t(77054),i=t(61648),s=t(35016);let{signIn:a,signOut:l,signUp:o,useSession:d}=(0,n.X)({baseURL:s.env.NEXT_PUBLIC_BETTER_AUTH_URL||"http://localhost:5000",plugins:[(0,i.zB)()]})}},function(e){e.O(0,[6812,7220,6803,7294,1604,6877,55,2542,7340,1826,3669,2757,1744],function(){return e(e.s=40527)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{40527:function(e,r,t){Promise.resolve().then(t.bind(t,10672))},628:function(e,r,t){"use strict";t.d(r,{Z:function(){return Z}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(69899),c=t(11379),h=t(9049);function m(e){return(0,h.ZP)("MuiCard",e)}(0,c.Z)("MuiCard",["root"]);var x=t(94655);let p=["className","raised"],f=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},m,r)},g=(0,o.ZP)(u.Z,{name:"MuiCard",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({overflow:"hidden"}));var Z=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCard"}),{className:s,raised:l=!1}=t,o=(0,i.Z)(t,p),u=(0,n.Z)({},t,{raised:l}),c=f(u);return(0,x.jsx)(g,(0,n.Z)({className:(0,a.Z)(c.root,s),elevation:l?8:void 0,ref:r,ownerState:u},o))})},41565:function(e,r,t){"use strict";t.d(r,{Z:function(){return g}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(11379),c=t(9049);function h(e){return(0,c.ZP)("MuiCardContent",e)}(0,u.Z)("MuiCardContent",["root"]);var m=t(94655);let x=["className","component"],p=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},h,r)},f=(0,o.ZP)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}}));var g=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCardContent"}),{className:s,component:l="div"}=t,o=(0,i.Z)(t,x),u=(0,n.Z)({},t,{component:l}),c=p(u);return(0,m.jsx)(f,(0,n.Z)({as:l,className:(0,a.Z)(c.root,s),ownerState:u,ref:r},o))})},10672:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return m}});var n=t(94655),i=t(74228),s=t(67337),a=t(7281),l=t(628),o=t(41565),d=t(31317),u=t(41261),c=t(85480),h=t(46725);function m(){let e=(0,i.useRouter)();return(0,n.jsx)(s.Z,{maxWidth:"sm",children:(0,n.jsx)(a.Z,{sx:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",py:4},children:(0,n.jsx)(l.Z,{sx:{width:"100%",maxWidth:500},children:(0,n.jsxs)(o.Z,{sx:{p:4},children:[(0,n.jsx)(d.Z,{variant:"h4",component:"h1",gutterBottom:!0,sx:{fontWeight:600,textAlign:"center",mb:3},children:"Welcome Back"}),(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",mb:4},children:"Sign in to manage your Minecraft servers"}),(0,n.jsx)(c.U0,{onSuccess:()=>{e.push("/dashboard")}}),(0,n.jsx)(a.Z,{sx:{mt:3,textAlign:"center"},children:(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",children:["Don't have an account?"," ",(0,n.jsx)(u.Z,{component:h.default,href:"/signup",underline:"hover",children:"Sign up"})]})})]})})})})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return x},WS:function(){return p},Ie:function(){return k}});var n=t(94655),i=t(35106),s=t(7281),a=t(81071),l=t(97436),o=t(52082),d=t(79983),u=t(30417),c=t(36848),h=t(554),m=t(6986);function x(e){let{onSuccess:r}=e,[t,x]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(!1),[v,j]=(0,i.useState)({}),[y,b]=(0,i.useState)(null),[w,C]=(0,i.useState)(!1),S=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),j(e),0===Object.keys(e).length},P=async e=>{if(e.preventDefault(),b(null),S()){C(!0);try{let e=await m.zB.email({email:t,password:p});if(e.error){b(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){b("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:P,sx:{display:"flex",flexDirection:"column",gap:2},children:[y&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>b(null),children:y}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>x(e.target.value),error:!!v.email,helperText:v.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!v.password,helperText:v.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!g)},edge:"end",children:g?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,x]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(""),[v,j]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[S,P]=(0,i.useState)({}),[k,W]=(0,i.useState)(null),[I,R]=(0,i.useState)(!1),q=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",v?g!==v&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",P(e),0===Object.keys(e).length},E=async e=>{if(e.preventDefault(),W(null),q()){R(!0);try{let e=await m.y1.email({email:p,password:g,name:t});if(e.error){W(e.error.message||"Registration failed"),R(!1);return}r&&r()}catch(e){W("An unexpected error occurred. Please try again."),R(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:E,sx:{display:"flex",flexDirection:"column",gap:2},children:[k&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>W(null),children:k}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>x(e.target.value),error:!!S.name,helperText:S.name,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!S.email,helperText:S.email,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:y?"text":"password",value:g,onChange:e=>Z(e.target.value),error:!!S.password,helperText:S.password,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!y)},edge:"end",children:y?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:v,onChange:e=>j(e.target.value),error:!!S.confirmPassword,helperText:S.confirmPassword,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:I,fullWidth:!0,size:"large",children:I?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),Z=t(86702),v=t(35694),j=t(31317),y=t(25333),b=t(69123),w=t(7178),C=t(17820),S=t(73424),P=t(78319);function k(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,m.kP)(),[a,l]=(0,i.useState)(null),o=()=>{l(null)},c=async()=>{o(),await (0,m.w7)(),e.push("/login")};if(t)return(0,n.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(u.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:h}=r,x=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(h.name,h.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(Z.Z,{sx:{bgcolor:"primary.main"},children:x})}),(0,n.jsxs)(v.Z,{anchorEl:a,open:!!a,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(s.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(j.Z,{variant:"subtitle1",fontWeight:"600",children:h.name||"User"}),(0,n.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:h.email}),"admin"===h.role&&(0,n.jsx)(y.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(b.Z,{}),(0,n.jsxs)(w.Z,{onClick:c,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(P.Z,{fontSize:"small"})}),(0,n.jsx)(S.Z,{children:"Logout"})]})]})]})}},6986:function(e,r,t){"use strict";t.d(r,{kP:function(){return d},w7:function(){return l},y1:function(){return o},zB:function(){return a}});var n=t(77054),i=t(61648),s=t(35016);let{signIn:a,signOut:l,signUp:o,useSession:d}=(0,n.X)({baseURL:s.env.NEXT_PUBLIC_BETTER_AUTH_URL||"http://localhost:5000",plugins:[(0,i.zB)()]})}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,55,3543,2149,2542,8322,3669,2757,1744],function(){return e(e.s=40527)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4966],{24100:function(e,r,t){Promise.resolve().then(t.bind(t,85795))},628:function(e,r,t){"use strict";t.d(r,{Z:function(){return Z}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(69899),c=t(11379),h=t(9049);function x(e){return(0,h.ZP)("MuiCard",e)}(0,c.Z)("MuiCard",["root"]);var m=t(94655);let p=["className","raised"],f=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},x,r)},g=(0,o.ZP)(u.Z,{name:"MuiCard",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({overflow:"hidden"}));var Z=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCard"}),{className:s,raised:l=!1}=t,o=(0,i.Z)(t,p),u=(0,n.Z)({},t,{raised:l}),c=f(u);return(0,m.jsx)(g,(0,n.Z)({className:(0,a.Z)(c.root,s),elevation:l?8:void 0,ref:r,ownerState:u},o))})},41565:function(e,r,t){"use strict";t.d(r,{Z:function(){return g}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(11379),c=t(9049);function h(e){return(0,c.ZP)("MuiCardContent",e)}(0,u.Z)("MuiCardContent",["root"]);var x=t(94655);let m=["className","component"],p=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},h,r)},f=(0,o.ZP)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}}));var g=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCardContent"}),{className:s,component:l="div"}=t,o=(0,i.Z)(t,m),u=(0,n.Z)({},t,{component:l}),c=p(u);return(0,x.jsx)(f,(0,n.Z)({as:l,className:(0,a.Z)(c.root,s),ownerState:u,ref:r},o))})},85795:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return x}});var n=t(94655),i=t(74228),s=t(67337),a=t(7281),l=t(628),o=t(41565),d=t(31317),u=t(41261),c=t(85480),h=t(46725);function x(){let e=(0,i.useRouter)();return(0,n.jsx)(s.Z,{maxWidth:"sm",children:(0,n.jsx)(a.Z,{sx:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",py:4},children:(0,n.jsx)(l.Z,{sx:{width:"100%",maxWidth:500},children:(0,n.jsxs)(o.Z,{sx:{p:4},children:[(0,n.jsx)(d.Z,{variant:"h4",component:"h1",gutterBottom:!0,sx:{fontWeight:600,textAlign:"center",mb:3},children:"Create Account"}),(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",mb:4},children:"Sign up to start managing Minecraft servers"}),(0,n.jsx)(c.WS,{onSuccess:()=>{e.push("/dashboard")}}),(0,n.jsx)(a.Z,{sx:{mt:3,textAlign:"center"},children:(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",children:["Already have an account?"," ",(0,n.jsx)(u.Z,{component:h.default,href:"/login",underline:"hover",children:"Sign in"})]})})]})})})})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return m},WS:function(){return p},Ie:function(){return W}});var n=t(94655),i=t(35106),s=t(7281),a=t(56877),l=t(97436),o=t(52082),d=t(79983),u=t(30417),c=t(36848),h=t(554),x=t(6986);function m(e){let{onSuccess:r}=e,[t,m]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(!1),[v,j]=(0,i.useState)({}),[y,b]=(0,i.useState)(null),[w,C]=(0,i.useState)(!1),S=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),j(e),0===Object.keys(e).length},P=async e=>{if(e.preventDefault(),b(null),S()){C(!0);try{let e=await x.zB.email({email:t,password:p});if(e.error){b(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){b("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:P,sx:{display:"flex",flexDirection:"column",gap:2},children:[y&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>b(null),children:y}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>m(e.target.value),error:!!v.email,helperText:v.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!v.password,helperText:v.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!g)},edge:"end",children:g?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,m]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(""),[v,j]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[S,P]=(0,i.useState)({}),[W,k]=(0,i.useState)(null),[A,I]=(0,i.useState)(!1),R=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",v?g!==v&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",P(e),0===Object.keys(e).length},q=async e=>{if(e.preventDefault(),k(null),R()){I(!0);try{let e=await x.y1.email({email:p,password:g,name:t});if(e.error){k(e.error.message||"Registration failed"),I(!1);return}r&&r()}catch(e){k("An unexpected error occurred. Please try again."),I(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:q,sx:{display:"flex",flexDirection:"column",gap:2},children:[W&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>k(null),children:W}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>m(e.target.value),error:!!S.name,helperText:S.name,disabled:A,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!S.email,helperText:S.email,disabled:A,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:y?"text":"password",value:g,onChange:e=>Z(e.target.value),error:!!S.password,helperText:S.password,disabled:A,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!y)},edge:"end",children:y?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:v,onChange:e=>j(e.target.value),error:!!S.confirmPassword,helperText:S.confirmPassword,disabled:A,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:A,fullWidth:!0,size:"large",children:A?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),Z=t(86702),v=t(35694),j=t(31317),y=t(25333),b=t(69123),w=t(7178),C=t(17820),S=t(73424),P=t(78319);function W(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,x.kP)(),[a,l]=(0,i.useState)(null),o=()=>{l(null)},c=async()=>{o(),await (0,x.w7)(),e.push("/login")};if(t)return(0,n.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(u.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:h}=r,m=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(h.name,h.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(Z.Z,{sx:{bgcolor:"primary.main"},children:m})}),(0,n.jsxs)(v.Z,{anchorEl:a,open:!!a,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(s.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(j.Z,{variant:"subtitle1",fontWeight:"600",children:h.name||"User"}),(0,n.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:h.email}),"admin"===h.role&&(0,n.jsx)(y.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(b.Z,{}),(0,n.jsxs)(w.Z,{onClick:c,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(P.Z,{fontSize:"small"})}),(0,n.jsx)(S.Z,{children:"Logout"})]})]})]})}},6986:function(e,r,t){"use strict";t.d(r,{kP:function(){return d},w7:function(){return l},y1:function(){return o},zB:function(){return a}});var n=t(77054),i=t(61648),s=t(35016);let{signIn:a,signOut:l,signUp:o,useSession:d}=(0,n.X)({baseURL:s.env.NEXT_PUBLIC_BETTER_AUTH_URL||"http://localhost:5000",plugins:[(0,i.zB)()]})}},function(e){e.O(0,[6812,7220,6803,7294,1604,6877,55,2542,7340,1826,3669,2757,1744],function(){return e(e.s=24100)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4966],{24100:function(e,r,t){Promise.resolve().then(t.bind(t,85795))},628:function(e,r,t){"use strict";t.d(r,{Z:function(){return Z}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(69899),c=t(11379),h=t(9049);function x(e){return(0,h.ZP)("MuiCard",e)}(0,c.Z)("MuiCard",["root"]);var m=t(94655);let p=["className","raised"],f=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},x,r)},g=(0,o.ZP)(u.Z,{name:"MuiCard",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({overflow:"hidden"}));var Z=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCard"}),{className:s,raised:l=!1}=t,o=(0,i.Z)(t,p),u=(0,n.Z)({},t,{raised:l}),c=f(u);return(0,m.jsx)(g,(0,n.Z)({className:(0,a.Z)(c.root,s),elevation:l?8:void 0,ref:r,ownerState:u},o))})},41565:function(e,r,t){"use strict";t.d(r,{Z:function(){return g}});var n=t(81500),i=t(32324),s=t(35106),a=t(70316),l=t(65951),o=t(34519),d=t(28057),u=t(11379),c=t(9049);function h(e){return(0,c.ZP)("MuiCardContent",e)}(0,u.Z)("MuiCardContent",["root"]);var x=t(94655);let m=["className","component"],p=e=>{let{classes:r}=e;return(0,l.Z)({root:["root"]},h,r)},f=(0,o.ZP)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,r)=>r.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}}));var g=s.forwardRef(function(e,r){let t=(0,d.i)({props:e,name:"MuiCardContent"}),{className:s,component:l="div"}=t,o=(0,i.Z)(t,m),u=(0,n.Z)({},t,{component:l}),c=p(u);return(0,x.jsx)(f,(0,n.Z)({as:l,className:(0,a.Z)(c.root,s),ownerState:u,ref:r},o))})},85795:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return x}});var n=t(94655),i=t(74228),s=t(67337),a=t(7281),l=t(628),o=t(41565),d=t(31317),u=t(41261),c=t(85480),h=t(46725);function x(){let e=(0,i.useRouter)();return(0,n.jsx)(s.Z,{maxWidth:"sm",children:(0,n.jsx)(a.Z,{sx:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",py:4},children:(0,n.jsx)(l.Z,{sx:{width:"100%",maxWidth:500},children:(0,n.jsxs)(o.Z,{sx:{p:4},children:[(0,n.jsx)(d.Z,{variant:"h4",component:"h1",gutterBottom:!0,sx:{fontWeight:600,textAlign:"center",mb:3},children:"Create Account"}),(0,n.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",mb:4},children:"Sign up to start managing Minecraft servers"}),(0,n.jsx)(c.WS,{onSuccess:()=>{e.push("/dashboard")}}),(0,n.jsx)(a.Z,{sx:{mt:3,textAlign:"center"},children:(0,n.jsxs)(d.Z,{variant:"body2",color:"text.secondary",children:["Already have an account?"," ",(0,n.jsx)(u.Z,{component:h.default,href:"/login",underline:"hover",children:"Sign in"})]})})]})})})})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return m},WS:function(){return p},Ie:function(){return W}});var n=t(94655),i=t(35106),s=t(7281),a=t(81071),l=t(97436),o=t(52082),d=t(79983),u=t(30417),c=t(36848),h=t(554),x=t(6986);function m(e){let{onSuccess:r}=e,[t,m]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(!1),[v,j]=(0,i.useState)({}),[y,b]=(0,i.useState)(null),[w,C]=(0,i.useState)(!1),S=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),j(e),0===Object.keys(e).length},P=async e=>{if(e.preventDefault(),b(null),S()){C(!0);try{let e=await x.zB.email({email:t,password:p});if(e.error){b(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){b("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:P,sx:{display:"flex",flexDirection:"column",gap:2},children:[y&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>b(null),children:y}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>m(e.target.value),error:!!v.email,helperText:v.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!v.password,helperText:v.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!g)},edge:"end",children:g?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,m]=(0,i.useState)(""),[p,f]=(0,i.useState)(""),[g,Z]=(0,i.useState)(""),[v,j]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,C]=(0,i.useState)(!1),[S,P]=(0,i.useState)({}),[W,k]=(0,i.useState)(null),[A,I]=(0,i.useState)(!1),R=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",v?g!==v&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",P(e),0===Object.keys(e).length},q=async e=>{if(e.preventDefault(),k(null),R()){I(!0);try{let e=await x.y1.email({email:p,password:g,name:t});if(e.error){k(e.error.message||"Registration failed"),I(!1);return}r&&r()}catch(e){k("An unexpected error occurred. Please try again."),I(!1)}}};return(0,n.jsxs)(s.Z,{component:"form",onSubmit:q,sx:{display:"flex",flexDirection:"column",gap:2},children:[W&&(0,n.jsx)(a.Z,{severity:"error",onClose:()=>k(null),children:W}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>m(e.target.value),error:!!S.name,helperText:S.name,disabled:A,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!S.email,helperText:S.email,disabled:A,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:y?"text":"password",value:g,onChange:e=>Z(e.target.value),error:!!S.password,helperText:S.password,disabled:A,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!y)},edge:"end",children:y?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:v,onChange:e=>j(e.target.value),error:!!S.confirmPassword,helperText:S.confirmPassword,disabled:A,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(d.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(c.Z,{}):(0,n.jsx)(h.Z,{})})})}}),(0,n.jsx)(u.Z,{type:"submit",variant:"contained",color:"primary",disabled:A,fullWidth:!0,size:"large",children:A?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),Z=t(86702),v=t(35694),j=t(31317),y=t(25333),b=t(69123),w=t(7178),C=t(17820),S=t(73424),P=t(78319);function W(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,x.kP)(),[a,l]=(0,i.useState)(null),o=()=>{l(null)},c=async()=>{o(),await (0,x.w7)(),e.push("/login")};if(t)return(0,n.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(u.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:h}=r,m=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(h.name,h.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(Z.Z,{sx:{bgcolor:"primary.main"},children:m})}),(0,n.jsxs)(v.Z,{anchorEl:a,open:!!a,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(s.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(j.Z,{variant:"subtitle1",fontWeight:"600",children:h.name||"User"}),(0,n.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:h.email}),"admin"===h.role&&(0,n.jsx)(y.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(b.Z,{}),(0,n.jsxs)(w.Z,{onClick:c,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(P.Z,{fontSize:"small"})}),(0,n.jsx)(S.Z,{children:"Logout"})]})]})]})}},6986:function(e,r,t){"use strict";t.d(r,{kP:function(){return d},w7:function(){return l},y1:function(){return o},zB:function(){return a}});var n=t(77054),i=t(61648),s=t(35016);let{signIn:a,signOut:l,signUp:o,useSession:d}=(0,n.X)({baseURL:s.env.NEXT_PUBLIC_BETTER_AUTH_URL||"http://localhost:5000",plugins:[(0,i.zB)()]})}},function(e){e.O(0,[6812,7220,8006,7294,8696,1071,55,3543,2149,2542,8322,3669,2757,1744],function(){return e(e.s=24100)}),_N_E=e.O()}]);