module.exports=[733057,a=>{"use strict";let b="better-auth",c="__Secure-",d=`${b}.session_token`;a.s(["AUTH_COOKIE_PREFIX",0,b,"SESSION_COOKIE_NAME",0,d,"isAuthCookie",0,function(a){return a.startsWith(b)||a.startsWith(`${c}${b}`)},"isSessionCookie",0,function(a){return a===d||a===`${c}${d}`}])},334209,a=>{"use strict";a.s(["ApiError",0,class extends Error{error;status;data;constructor(a,b,c){super(a.message),this.name="ApiError",this.error=a,this.status=b,this.data=c}}])},992676,a=>{"use strict";var b=a.i(733057),c=a.i(109972),d=a.i(334209);let e=null,f=!1;function g(){return null===e&&(e=process.env.INKEEP_AGENTS_API_URL||c.DEFAULT_INKEEP_AGENTS_API_URL,process.env.INKEEP_AGENTS_API_URL||f||(console.warn(`INKEEP_AGENTS_API_URL is not set, falling back to: ${c.DEFAULT_INKEEP_AGENTS_API_URL}`),f=!0)),e}async function h(c,e,f={}){let g,i=`${c}/${e}`;try{let{headers:c}=await a.A(568604),d=(await c()).get("cookie");if(d&&(g=d.split(";").map(a=>a.trim()).filter(a=>(0,b.isAuthCookie)(a)).join("; ")),!g){let{cookies:c}=await a.A(568604);g=(await c()).getAll().filter(a=>(0,b.isAuthCookie)(a.name)).map(a=>`${a.name}=${a.value}`).join("; ")}}catch{}let j=!!process.env.INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET,k=j?"bypass-secret":g?"cookie":"none";"none"===k&&console.warn(`[api-config] No auth credentials for ${e} - set INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET or ensure session cookies are forwarded`);let l={"Content-Type":"application/json",...f.headers,...g&&{Cookie:g},...j&&{Authorization:`Bearer ${process.env.INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET}`}};try{let a=await fetch(i,{...f,headers:l,cache:"no-store"});if(!a.ok){let b;try{let c=await a.text();b=c?JSON.parse(c):null}catch{b=null}if(400===a.status&&b?.errors&&Array.isArray(b.errors)){let c=b.errors.map(a=>`${a.name||a.pointer||"field"}: ${a.detail||a.reason||a.message}`).join(", "),e=`Validation failed: ${c}`;throw console.error("API Validation Error Response:",{status:a.status,errorData:b,validationErrors:c}),new d.ApiError({code:"validation_error",message:e},a.status)}let c=b?.error?.message||b?.message||b?.detail||`HTTP ${a.status}: ${a.statusText}`||"Unknown error occurred",e=b?.error?.code||b?.code||"unknown";throw console.error("API Error Response:",{status:a.status,statusText:a.statusText,errorData:b,errorMessage:c,errorCode:e,authMode:k}),new d.ApiError({code:e,message:c},a.status,b??void 0)}let b=a.headers.get("content-type");if(b?.includes("application/json")){let b=await a.text();return b?JSON.parse(b):void 0}return}catch(a){if(a instanceof d.ApiError)throw a;throw new d.ApiError({code:"internal_server_error",message:a instanceof Error?a.message:"Network error occurred"},500)}}async function i(a,b={}){return h(g(),`manage/${a}`,b)}a.s(["getAgentsApiUrl",0,g,"makeManagementApiRequest",0,i])},440570,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(420358)},97190,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},307429,a=>{"use strict";var b=a.i(440570),c=a.i(798688),d=a.i(992676),e=a.i(97190);async function f(a){let b=await (0,d.makeManagementApiRequest)(`tenants/${a}/projects?limit=100`);return b.data&&(b.data=b.data.map(a=>({...a,projectId:a.id}))),b}let g=(0,c.cache)(f);async function h(a,b){let c=await (0,d.makeManagementApiRequest)(`tenants/${a}/projects/${b}`);return c.data&&(c.data={...c.data,projectId:c.data.id}),c}let i=(0,c.cache)(h);async function j(a,b){let c=await (0,d.makeManagementApiRequest)(`tenants/${a}/projects`,{method:"POST",body:JSON.stringify(b)});return c.data&&(c.data={...c.data,projectId:c.data.id}),c}async function k(a,b,c){let e=await (0,d.makeManagementApiRequest)(`tenants/${a}/projects/${b}`,{method:"PATCH",body:JSON.stringify(c)});return e.data&&(e.data={...e.data,projectId:e.data.id}),e}async function l(a,b){await (0,d.makeManagementApiRequest)(`tenants/${a}/projects/${b}`,{method:"DELETE"})}async function m(a,b){return(await (0,d.makeManagementApiRequest)(`tenants/${a}/projects/${b}/permissions`)).data}let n=(0,c.cache)(m);async function o(a){return(0,d.makeManagementApiRequest)(`tenants/${a}/projects?limit=100&include=agents`)}let p=(0,c.cache)(o);(0,e.ensureServerEntryExports)([j,k,l,g,i,n,p]),(0,b.registerServerReference)(j,"605f6650b025c77e3f917aede76939ebbc13d329b3",null),(0,b.registerServerReference)(k,"7021d0c0daaab3d266f9de270660418c826088bc64",null),(0,b.registerServerReference)(l,"60b5e5555ddc0c8ea0f2ac7b0928d04bcd139ffe09",null),(0,b.registerServerReference)(g,"7fdcc34acb7a086d62527ba427a74715624bd22725",null),(0,b.registerServerReference)(i,"7f441af27dacd0c6bd8c06a4191e557727cee2b16a",null),(0,b.registerServerReference)(n,"7f15918f065e660d0dd39d27ebd45f00d3a26fa66a",null),(0,b.registerServerReference)(p,"7f2c010be04316689912b8d5771beb25ecb1e2ec04",null),a.s(["createProject",0,j,"deleteProject",0,l,"fetchProject",0,i,"fetchProjectPermissions",0,n,"fetchProjects",0,g,"fetchProjectsWithAgents",0,p,"updateProject",0,k])},351071,a=>{"use strict";let b={not_found:404,forbidden:403,unauthorized:401,internal_server_error:500,service_unavailable:503,bad_request:400,validation_error:400,unprocessable_entity:422};a.s(["getErrorCode",0,function(a){return a&&"object"==typeof a?a.error?.code?a.error.code:a.code?a.code:a.status?function(a){switch(a){case 400:return"bad_request";case 401:return"unauthorized";case 403:return"forbidden";case 404:return"not_found";case 422:return"unprocessable_entity";case 500:return"internal_server_error";case 503:return"service_unavailable";default:return"unknown_error"}}(a.status):void 0:void 0},"getStatusCodeFromErrorCode",0,function(a){if(a)return b[a]}])},568604,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0blw_next_dist_shared_lib_action-revalidation-kind_0iim3me.js","server/chunks/ssr/0blw_next_0b3pfhf._.js"].map(b=>a.l(b))).then(()=>b(900566)))}];

//# sourceMappingURL=_0cm._47._.js.map