"use strict";exports.id=1308,exports.ids=[1308],exports.modules={41308:(e,t,a)=>{a.r(t),a.d(t,{createPteroServer:()=>l,createPteroUser:()=>o,deletePteroServer:()=>d,getPteroUserByEmail:()=>i,suspendPteroServer:()=>u,unsuspendPteroServer:()=>c});let s=process.env.PTERODACTYL_URL||"https://panel.example.com",r=process.env.PTERODACTYL_ADMIN_KEY||"";async function n(e,t={}){let a=`${s}/api/application${e}`,n={Authorization:`Bearer ${r}`,Accept:"application/json","Content-Type":"application/json",...t.headers||{}},i=await fetch(a,{...t,headers:n});if(!i.ok){let e=i.statusText;try{let t=await i.json();t.errors&&t.errors.length>0&&(e=t.errors.map(e=>e.detail||e.code).join(", "))}catch(e){}throw Error(`Pterodactyl API Error (${i.status}): ${e}`)}return 204===i.status?null:i.json()}async function i(e){let t=await n(`/users?filter[email]=${encodeURIComponent(e)}`);return t&&t.data&&t.data.length>0?t.data[0].attributes:null}async function o(e,t,a,s,r){let i=await n(`/users?filter[username]=${encodeURIComponent(t)}`),o=t;i&&i.data&&i.data.length>0&&(o=`${t}_${Math.floor(1e4*Math.random())}`);let l={email:e,username:o,first_name:a,last_name:s||"User"};return r&&(l.password=r),(await n("/users",{method:"POST",body:JSON.stringify(l)})).attributes}async function l(e){let t={},a="";try{let s=await n(`/nests/${e.nestId}/eggs/${e.eggId}?include=variables`);if(s&&s.attributes&&(a=s.attributes.startup||"",s.attributes.relationships&&s.attributes.relationships.variables))for(let e of s.attributes.relationships.variables.data){let a=e.attributes.env_variable,s=e.attributes.default_value;t[a]=null!==s?String(s):""}}catch(e){console.warn("[PTERO] Failed to fetch egg variables, using fallbacks",e)}("SERVER_MEMORY"in t||!Object.keys(t).length)&&(t.SERVER_MEMORY=e.memory.toString()),("SERVER_IP"in t||!Object.keys(t).length)&&(t.SERVER_IP="0.0.0.0"),("SERVER_PORT"in t||!Object.keys(t).length)&&(t.SERVER_PORT="25565");let s={name:e.name,user:e.userId,egg:e.eggId,docker_image:e.image,startup:e.startup||a||" ",environment:t,limits:{memory:e.memory,swap:0,disk:e.disk,io:500,cpu:e.cpu},feature_limits:{databases:e.databases,backups:e.backups,allocations:e.allocations},deploy:{locations:[e.locationId],dedicated_ip:!1,port_range:[]}};return(await n("/servers",{method:"POST",body:JSON.stringify(s)})).attributes}async function u(e){await n(`/servers/${e}/suspend`,{method:"POST"})}async function c(e){await n(`/servers/${e}/unsuspend`,{method:"POST"})}async function d(e){await n(`/servers/${e}`,{method:"DELETE"})}}};