module.exports=[24725,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},50227,(e,t,n)=>{t.exports=e.x("node:path",()=>require("node:path"))},22734,(e,t,n)=>{t.exports=e.x("fs",()=>require("fs"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,n)=>{t.exports=e.x("path",()=>require("path"))},24868,(e,t,n)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},54799,(e,t,n)=>{t.exports=e.x("crypto",()=>require("crypto"))},24361,(e,t,n)=>{t.exports=e.x("util",()=>require("util"))},33405,(e,t,n)=>{t.exports=e.x("child_process",()=>require("child_process"))},92509,(e,t,n)=>{t.exports=e.x("url",()=>require("url"))},27699,(e,t,n)=>{t.exports=e.x("events",()=>require("events"))},8098,e=>{"use strict";var t=e.i(22734),n=e.i(24868),r=e.i(14747),i=e.i(54799);function a(e){return"number"==typeof e.lookbackDays?e:{...e,lookbackDays:90}}function o(){return r.default.join(process.cwd(),"data","invites.json")}function s(){let e=r.default.dirname(o());t.default.existsSync(e)||t.default.mkdirSync(e,{recursive:!0})}function l(){try{if(!t.default.existsSync(o()))return[];let e=t.default.readFileSync(o(),"utf8"),n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function d(e){s(),t.default.writeFileSync(o(),JSON.stringify(e,null,2),"utf8")}function u(e){if(!e.startsWith("inv_"))return;let t=l().find(t=>t.token===e);return t?a(t):void 0}function c(e){let t=u(e);return t?t.completedAt?{ok:!1,reason:"used",invite:t}:new Date(t.expiresAt).getTime()<Date.now()?{ok:!1,reason:"expired",invite:t}:{ok:!0,invite:t}:{ok:!1,reason:"not_found"}}let p=["EXPERTISE","DECISIONS","CONTEXT","PEOPLE","PROJECTS","PREFERENCES","TONE","BOUNDARIES","EMPLOYMENT"];function f(e){return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}async function m(e,t){let i,a,o=u(e);if(!o)throw Error("invite not found");if(o.employeeId)return{employeeId:o.employeeId,reused:!0};let s=(t?.name||o.name||"").trim(),c=(t?.role||o.role||"").trim(),m=f(s);m||(m=f(c)),m||(m=`pending-${e.slice(4,10)}`);let v=`${m}-${e.slice(4,10)}`,x=r.default.join(process.cwd(),"data","employees",v),h=r.default.join(x,"employee.json");try{return await n.default.access(h),{employeeId:v,reused:!0}}catch{}await n.default.mkdir(x,{recursive:!0});let g=s||`Pending (${e.slice(4,10)})`,y=(i=new Date().toISOString().slice(0,10),(a={}).EMPLOYMENT=`# Employment — ${g}

- Name: ${g}
${c?`- Role: ${c}
`:""}- Onboarded: ${i}
`,a.EXPERTISE=`# Expertise — ${g}

_To be filled in during onboarding._
`,a.BOUNDARIES=`# Boundaries — ${g}

_To be filled in during onboarding._
`,a.CONTEXT=`# Context — ${g}

_To be filled in during onboarding._
`,a.DECISIONS=`# Decisions — ${g}

_To be filled in during onboarding._
`,a.PEOPLE=`# People — ${g}

_To be filled in during onboarding._
`,a.PROJECTS=`# Projects — ${g}

_To be filled in during onboarding._
`,a.PREFERENCES=`# Preferences — ${g}

_To be filled in during onboarding._
`,a.TONE=`# Tone — ${g}

_To be filled in during onboarding._
`,a);return await Promise.all(p.map(async e=>{let t=r.default.join(x,`${e}.md`);try{await n.default.access(t)}catch{await n.default.writeFile(t,y[e],"utf8")}})),await n.default.writeFile(h,JSON.stringify({id:v,name:g,role:c||null,integrations:[],createdAt:new Date().toISOString(),lastActiveAt:new Date().toISOString(),via:{invite:e},pendingProfile:!s},null,2),"utf8"),!function(e,t){let n=l(),r=n.findIndex(t=>t.token===e);if(r<0)return;let i=n[r];i.employeeId===t||i.employeeId&&i.employeeId!==t||(n[r]={...i,employeeId:t},d(n))}(e,v),{employeeId:v,reused:!1}}e.s(["bulkRevokeInvites",0,function(e){let t=Date.now(),n=l(),r=[],i=n.filter(n=>!(!n.completedAt&&("expired"===e?new Date(n.expiresAt).getTime()<t:!n.employeeId))||(r.push(n.token),!1));return r.length>0&&d(i),{removed:r.length,tokens:r}},"classifyInvite",0,c,"createInvite",0,function(e){let t=`inv_${(0,i.randomBytes)(20).toString("hex")}`,n=new Date,r=new Date(n.getTime()+12096e5),a={token:t,name:e.name?.trim()||void 0,role:e.role?.trim()||void 0,createdAt:n.toISOString(),expiresAt:r.toISOString(),lookbackDays:function(e){let t="number"==typeof e?e:Number(e);if(!Number.isFinite(t))return 90;let n=Math.round(t);return n<30?30:n>360?360:n}(void 0===e.lookbackDays?90:e.lookbackDays)},o=l();return o.push(a),d(o),a},"findInvite",0,u,"isInviteRedeemable",0,function(e){let t=u(e);if(t&&!t.completedAt&&!(new Date(t.expiresAt).getTime()<Date.now()))return t},"listInvites",0,function(){return l().filter(e=>"string"==typeof e?.token).map(a).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))},"markInviteCompleted",0,function(e,t){let n=l(),r=n.findIndex(t=>t.token===e);if(-1!==r)return n[r]={...n[r],completedAt:new Date().toISOString(),employeeId:t},d(n),n[r]},"materializeEmployeeFromInvite",0,m,"releaseInviteClaim",0,function(e){let n=r.default.join(r.default.dirname(o()),`.invite-${e}.lock`);try{t.default.unlinkSync(n)}catch{}},"revokeInvite",0,function(e){let t=l(),n=t.filter(t=>t.token!==e);return n.length!==t.length&&(d(n),!0)},"tryClaimInvite",0,function(e){let n=c(e);if(!n.ok)return{claimed:!1,reason:n.reason};s();let i=r.default.join(r.default.dirname(o()),`.invite-${e}.lock`);try{t.default.writeFileSync(i,String(process.pid),{flag:"wx"});let n=c(e);if(!n.ok){try{t.default.unlinkSync(i)}catch{}return{claimed:!1,reason:n.reason}}return{claimed:!0}}catch(e){if(e&&"EEXIST"===e.code)return{claimed:!1,reason:"already_claimed"};throw e}}])},78542,e=>{"use strict";var t=e.i(47909),n=e.i(74017),r=e.i(96250),i=e.i(59756),a=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(74838),v=e.i(10372),x=e.i(93695);e.i(20232);var h=e.i(220),g=e.i(89171),y=e.i(8098),E=e.i(20993);async function R(e,{params:t}){let{token:n}=await t,r=(0,y.classifyInvite)(n);if(!r.ok&&"not_found"===r.reason)return g.NextResponse.json({status:"not_found"},{status:404});if(!r.ok&&"expired"===r.reason)return g.NextResponse.json({status:"expired"},{status:410});let i=(r.ok,r.invite??(0,y.findInvite)(n)),a=i?.employeeId??null;if(!a)return g.NextResponse.json({employeeId:null,connections:{},pendingEmployee:!0});let o=await (0,E.readState)(a);return g.NextResponse.json({employeeId:a,connections:o.connections,pendingEmployee:!1})}e.s(["GET",0,R,"runtime",0,"nodejs"],32507);var w=e.i(32507);let k=new t.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/invites/[token]/connections/route",pathname:"/api/invites/[token]/connections",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/invites/[token]/connections/route.ts",nextConfigOutput:"standalone",userland:w,...{}}),{workAsyncStorage:S,workUnitAsyncStorage:b,serverHooks:I}=k;async function _(e,t,r){r.requestMeta&&(0,i.setRequestMeta)(e,r.requestMeta),k.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/invites/[token]/connections/route";g=g.replace(/\/index$/,"")||"/";let y=await k.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:E,params:R,nextConfig:w,parsedUrl:S,isDraftMode:b,prerenderManifest:I,routerServerContext:_,isOnDemandRevalidate:T,revalidateOnlyGenerated:C,resolvedPathname:A,clientReferenceManifest:N,serverActionsManifest:O}=y,P=(0,s.normalizeAppPath)(g),D=!!(I.dynamicRoutes[P]||I.routes[A]),j=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,S,!1):t.end("This page could not be found"),null);if(D&&!b){let e=!!I.routes[A],t=I.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await j();throw new x.NoFallbackError}}let q=null;!D||k.isDev||b||(q="/index"===(q=A)?"/":q);let $=!0===k.isDev||!D,M=D&&!$;O&&N&&(0,o.setManifestsSingleton)({page:g,clientReferenceManifest:N,serverActionsManifest:O});let F=e.method||"GET",U=(0,a.getTracer)(),H=U.getActiveScopeSpan(),B=!!(null==_?void 0:_.isWrappedByNextServer),L=!!(0,i.getRequestMeta)(e,"minimalMode"),K=(0,i.getRequestMeta)(e,"incrementalCache")||await k.getIncrementalCache(e,w,I,L);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let X={params:R,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:$,incrementalCache:K,cacheLifeProfiles:w.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,r,i)=>k.onRequestError(e,t,r,i,_)},sharedContext:{buildId:E}},J=new l.NodeNextRequest(e),z=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(J,(0,d.signalFromNodeResponse)(t));try{let i,o=async e=>k.handle(G,X).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let n=U.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=n.get("next.route");if(r){let t=`${F} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",r),i.updateName(t))}else e.updateName(`${F} ${g}`)}),s=async i=>{var a,s;let l=async({previousCacheEntry:n})=>{try{if(!L&&T&&C&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(i);e.fetchMetrics=X.renderOpts.fetchMetrics;let s=X.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let l=X.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(J,z,a,X.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[v.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,r=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:X.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:r}}}}catch(t){throw(null==n?void 0:n.isStale)&&await k.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,_),t}},d=await k.handleResponse({req:e,nextConfig:w,cacheKey:q,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:C,responseGenerator:l,waitUntil:r.waitUntil,isMinimalMode:L});if(!D)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(s=d.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&D||u.delete(v.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(J,z,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&H?await s(H):(i=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${g}`,kind:a.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},s),void 0,!B))}catch(t){if(t instanceof x.NoFallbackError||await k.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,_),D)throw t;return await (0,p.sendResponse)(J,z,new Response(null,{status:500})),null}}e.s(["handler",0,_,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:b})},"routeModule",0,k,"serverHooks",0,I,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,b],78542)},30887,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_stream_0g9s3ok._.js","server/chunks/[root-of-the-server]__0gqp_8t._.js"].map(t=>e.l(t))).then(()=>t(41379)))}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0eq4dl0._.js.map