import{DEFAULT_AUTHENTICATED_TEAM as t,DEFAULT_ANONYMOUS_VISITOR_TEAM as $,DEFAULT_RBAC_SCOPE as d,PUBLIC_RBAC_SCOPE_ITEM as T}from"../../constants/index.js";import{bold as e}from"../utils/reporter/colors.js";import{reporter as u}from"../utils/reporter/reporter.js";import{logger as E}from"../utils/index.js";var c;(function(n){n[n.Frontmatter=0]="Frontmatter",n[n.RootRedoclyYaml=1]="RootRedoclyYaml"})(c||(c={}));function _(n,y=c.Frontmatter){y===c.RootRedoclyYaml&&!n?.content?.[d]&&E.warn(`Your ${e("rbac:")} configuration is missing ${e("**:")} property. In case you do not specify it, portal will treat it as ${e('"*": read')}.`);const m=n.content||{[d]:T};for(const s of Object.keys(m)){const a=m[s],i=Object.keys(a),r=i.filter(o=>![t,$,"*"].includes(o)&&!/^\S+@\S+\.\S+$/.test(o)),f=r.length>0,p=i.includes(t);if(f&&!p&&i.includes("*")){const o=a[r[0]],l=o==="none"?"read":"none";u.panicOnBuildContentError(`Incompatible roles for ${e(s)}: all members of ${e(r[0])} are always members of ${e(t)} and they have different roles. * includes ${t}.

        Hint: you may want to specify the same role for ${t} team:

        '${s}':
          ${r[0]}: ${o}
          ${t}: ${o}
          ${$}: ${o}
          '*': ${l}
        `)}if(f&&p){const o=a[r[0]],l=a[t];(o==="none"&&l!=="none"||o!=="none"&&l==="none")&&u.panicOnBuildContentError(`Incompatible roles for ${e(s)}: all members of ${e(r[0])} are always members of ${e(t)} and they have different roles. Role of ${t} should be the same as for ${e(r[0])}.`)}}}export{c as RbacConfigLocation,_ as validateRbacConfig};
