import{SecurityVariablesEnvSuffix as o}from"@redocly/theme/core/openapi";import{escapeFormId as c}from"./string.js";import{fromSessionStorage as e,toSessionStorage as r}from"./session-storage.js";function p(t,s){t=c(t),r(`auth.${t}.variants`,JSON.stringify(s))}function S(t,s={}){return{raw:s[t+o.APIKey],password:s[t+o.Password],username:s[t+o.Username],token:s[t+o.Token]?{access_token:s[t+o.Token]}:void 0,client_id:s[t+o.ClientId],client_secret:s[t+o.ClientSecret],scopes:e(`auth.${t}.scopes`)}}function h(t,s){t=c(t),typeof s=="string"?r("auth."+t,s):s&&(r(`auth.${t}.password`,s.password||""),r(`auth.${t}.username`,s.username||""),r(`auth.${t}.token`,s.token&&JSON.stringify(s.token)||""),r(`auth.${t}.client_id`,s.client_id||""),r(`auth.${t}.client_secret`,s.client_secret||""),r(`auth.${t}.scopes`,s.scopes&&JSON.stringify(s.scopes)||""))}export{S as getSecurityDetails,h as setSecurityDetails,p as setSecurityDetailsVariants};
