Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`node:crypto`);function t(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function n(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?t(`expected config object`):Object.keys(e).length>0?t(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function r(e){let t=e.email??void 0;return{profiles:[{profileId:`${e.profilePrefix??e.providerId}:${t??`default`}`,credential:{type:`oauth`,provider:e.providerId,access:e.access,...e.refresh?{refresh:e.refresh}:{},...Number.isFinite(e.expires)?{expires:e.expires}:{},...t?{email:t}:{},...e.credentialExtra}}],configPatch:e.configPatch??{agents:{defaults:{models:{[e.defaultModel]:{}}}}},defaultModel:e.defaultModel,notes:e.notes}}function i(e){return Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`)}function a(){let t=(0,e.randomBytes)(32).toString(`base64url`);return{verifier:t,challenge:(0,e.createHash)(`sha256`).update(t).digest(`base64url`)}}exports.buildOauthProviderAuthResult=r,exports.emptyPluginConfigSchema=n,exports.generatePkceVerifierChallenge=a,exports.toFormUrlEncoded=i;
