import{ef as s,ff as u,gf as a,hf as m,if as p,jf as c}from"./chunk-2GUKPKKM.js";import{e as l}from"./chunk-SZAW6ZBW.js";var n,d=l(()=>{c();u();m();n=class{constructor(e){if(!e){this.authorizedGroups=[],this.privilegeSets=[];return}this.authorizedGroups=e.authorizedGroups,this.associatePrivilegeSetsWithEntries=e.associatePrivilegeSetsWithEntries,this.temporaryGroupNamePrefix=e.temporaryGroupNamePrefix,this.privilegeSetsEnabled=e.privilegeSetsEnabled,this.temporaryGroupNamePrefix=e.temporaryGroupNamePrefix,this.temporaryGroupCreationLocation=e.temporaryGroupCreationLocation,this.templateAccountCreationLocation=e.templateAccountCreationLocation,this.privilegeSets=(e.privilegeSets??[]).map(i=>({privilegeSetName:i.privilegeSetName,connectionIds:i.connectionIds,groups:i.groupExternalIds.map(r=>new s({displayName:this.authorizedGroups.find(t=>t.externalId===r)?.displayName,name:this.authorizedGroups.find(t=>t.externalId===r)?.name,externalId:this.authorizedGroups.find(t=>t.externalId===r)?.externalId,detail:this.authorizedGroups.find(t=>t.externalId===r)?.detail})).filter(r=>r.externalId).sort((r,t)=>(r.displayName||r.name).localeCompare(t.displayName||t.name))})).sort((i,r)=>i.privilegeSetName.localeCompare(r.privilegeSetName))}ToPamJitElevationInfo(){let e=new p;return e.authorizedGroups=this.authorizedGroups,e.associatePrivilegeSetsWithEntries=this.associatePrivilegeSetsWithEntries,e.temporaryGroupNamePrefix=this.temporaryGroupNamePrefix,e.privilegeSetsEnabled=this.privilegeSetsEnabled,e.temporaryGroupNamePrefix=this.temporaryGroupNamePrefix,e.temporaryGroupCreationLocation=this.temporaryGroupCreationLocation,e.templateAccountCreationLocation=this.templateAccountCreationLocation,e.privilegeSets=this.privilegeSets.map(i=>{let r=new a;return r.privilegeSetName=i.privilegeSetName,r.connectionIds=i.connectionIds,r.groupExternalIds=i.groups.map(t=>t.externalId).filter(t=>!!t),r}),e}getSetsForConnection(e){return this.privilegeSetsEnabled?this.privilegeSets.filter(i=>!this.associatePrivilegeSetsWithEntries||i.connectionIds.some(r=>r.id===e)):[]}getSetsForGroup(e){return this.privilegeSets.filter(i=>!this.associatePrivilegeSetsWithEntries||i.groups.some(r=>r.externalId===e))}getGroupsForConnection(e){return this.privilegeSetsEnabled?this.getSetsForConnection(e).reduce((t,o)=>t.concat(o.groups),[]).map(t=>({group:t,setNames:this.getSetsForGroup(t.externalId).map(o=>o.privilegeSetName)})).sort((t,o)=>t.group.displayValue.localeCompare(o.group.displayValue)):(this.authorizedGroups||[]).map(i=>({group:i,setNames:[]})).sort((i,r)=>i.group.displayValue.localeCompare(r.group.displayValue))}}});export{n as a,d as b};
