module.exports=[62541,(e,r,t)=>{"use strict";var o=Object.create,n=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,u=(e,r,t,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let i of l(r))a.call(e,i)||i===t||n(e,i,{get:()=>r[i],enumerable:!(o=c(r,i))||o.enumerable});return e},d=(e,r,t)=>(t=null!=e?o(i(e)):{},u(!r&&e&&e.__esModule?t:n(t,"default",{value:e,enumerable:!0}),e)),s={},f={findRootDir:()=>w,getUserDataDir:()=>g};for(var p in f)n(s,p,{get:f[p],enumerable:!0});r.exports=u(n({},"__esModule",{value:!0}),s);var y=d(e.r(14747)),O=d(e.r(22734)),h=d(e.r(46786)),j=e.r(73939);function w(){try{let e=process.cwd();for(;e!==y.default.dirname(e);){let r=y.default.join(e,".vercel");if(O.default.existsSync(r))return e;e=y.default.dirname(e)}}catch(e){throw new j.VercelOidcTokenError("Token refresh only supported in node server environments")}throw new j.VercelOidcTokenError("Unable to find root directory")}function g(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(h.default.platform()){case"darwin":return y.default.join(h.default.homedir(),"Library/Application Support");case"linux":return y.default.join(h.default.homedir(),".local/share");case"win32":if(process.env.LOCALAPPDATA)return process.env.LOCALAPPDATA;return null;default:return null}}},39609,(e,r,t)=>{"use strict";var o=Object.create,n=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,u=(e,r,t,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let i of l(r))a.call(e,i)||i===t||n(e,i,{get:()=>r[i],enumerable:!(o=c(r,i))||o.enumerable});return e},d=(e,r,t)=>(t=null!=e?o(i(e)):{},u(!r&&e&&e.__esModule?t:n(t,"default",{value:e,enumerable:!0}),e)),s={},f={assertVercelOidcTokenResponse:()=>b,findProjectInfo:()=>v,getTokenPayload:()=>D,getVercelCliToken:()=>g,getVercelDataDir:()=>w,getVercelOidcToken:()=>k,isExpired:()=>E,loadToken:()=>T,saveToken:()=>m};for(var p in f)n(s,p,{get:f[p],enumerable:!0});r.exports=u(n({},"__esModule",{value:!0}),s);var y=d(e.r(14747)),O=d(e.r(22734)),h=e.r(73939),j=e.r(62541);function w(){let e=(0,j.getUserDataDir)();return e?y.join(e,"com.vercel.cli"):null}function g(){let e=w();if(!e)return null;let r=y.join(e,"auth.json");if(!O.existsSync(r))return null;let t=O.readFileSync(r,"utf8");return t?JSON.parse(t).token:null}async function k(e,r,t){try{let o=`https://api.vercel.com/v1/projects/${r}/token?source=vercel-oidc-refresh${t?`&teamId=${t}`:""}`,n=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new h.VercelOidcTokenError(`Failed to refresh OIDC token: ${n.statusText}`);let c=await n.json();return b(c),c}catch(e){throw new h.VercelOidcTokenError("Failed to refresh OIDC token",e)}}function b(e){if(!e||"object"!=typeof e)throw TypeError("Expected an object");if(!("token"in e)||"string"!=typeof e.token)throw TypeError("Expected a string-valued token property")}function v(){let e=(0,j.findRootDir)();if(!e)throw new h.VercelOidcTokenError("Unable to find root directory");try{let r=y.join(e,".vercel","project.json");if(!O.existsSync(r))throw new h.VercelOidcTokenError("project.json not found");let t=JSON.parse(O.readFileSync(r,"utf8"));if("string"!=typeof t.projectId&&"string"!=typeof t.orgId)throw TypeError("Expected a string-valued projectId property");return{projectId:t.projectId,teamId:t.orgId}}catch(e){throw new h.VercelOidcTokenError("Unable to find project ID",e)}}function m(e,r){try{let t=(0,j.getUserDataDir)();if(!t)throw new h.VercelOidcTokenError("Unable to find user data directory");let o=y.join(t,"com.vercel.token",`${r}.json`),n=JSON.stringify(e);O.mkdirSync(y.dirname(o),{mode:504,recursive:!0}),O.writeFileSync(o,n),O.chmodSync(o,432);return}catch(e){throw new h.VercelOidcTokenError("Failed to save token",e)}}function T(e){try{let r=(0,j.getUserDataDir)();if(!r)return null;let t=y.join(r,"com.vercel.token",`${e}.json`);if(!O.existsSync(t))return null;let o=JSON.parse(O.readFileSync(t,"utf8"));return b(o),o}catch(e){throw new h.VercelOidcTokenError("Failed to load token",e)}}function D(e){let r=e.split(".");if(3!==r.length)throw new h.VercelOidcTokenError("Invalid token");let t=r[1].replace(/-/g,"+").replace(/_/g,"/"),o=t.padEnd(t.length+(4-t.length%4)%4,"=");return JSON.parse(Buffer.from(o,"base64").toString("utf8"))}function E(e){return 1e3*e.exp<Date.now()}}];

//# sourceMappingURL=e0a3c_%40vercel_oidc_dist_bc24f7d6._.js.map