import{a as N,b as _}from"./chunk-DJLFA677.js";import{a as M,b as W}from"./chunk-NEKDTWKR.js";import{a as Q}from"./chunk-FAHXDSMM.js";import{$a as H,_a as U,m as R,n as x,wa as V,xa as G,ya as E,za as B}from"./chunk-THQOQSZV.js";import{c as s,d as z}from"./chunk-6B6CBPYV.js";import{a as q}from"./chunk-YBNTOQCK.js";import{O as T,Sa as O,be as A,g as I,na as w,r as D,ta as h,x as p,xa as m}from"./chunk-WL5U2YIT.js";import{a as g,e as v,h as C}from"./chunk-ADEKKGI2.js";var f,P=v(()=>{z();f=class a{toQueryString(){let e=[];if(this.customTypes)for(let i=0;i<this.customTypes.length;i++)this.customTypes[i]!==null&&e.push("customTypes="+encodeURIComponent(this.customTypes[i].toString()));if(this.filter!==null&&this.filter.toString()&&e.push("filter="+encodeURIComponent(this.filter.toString())),this.includeSubScanConfigurations!==null&&this.includeSubScanConfigurations.toString()&&e.push("includeSubScanConfigurations="+encodeURIComponent(this.includeSubScanConfigurations.toString())),this.inventoryScanType)for(let i=0;i<this.inventoryScanType.length;i++)this.inventoryScanType[i]!==null&&e.push("inventoryScanType="+encodeURIComponent(this.inventoryScanType[i].toString()));if(this.parentScanConfigurationID!==null&&this.parentScanConfigurationID.toString()&&e.push("parentScanConfigurationID="+encodeURIComponent(this.parentScanConfigurationID.toString())),this.providers)for(let i=0;i<this.providers.length;i++)this.providers[i]!==null&&e.push("providers="+encodeURIComponent(this.providers[i].toString()));return this.key!==null&&this.key.toString()&&e.push("key="+encodeURIComponent(this.key.toString())),this.pageNumber!==null&&this.pageNumber.toString()&&e.push("pageNumber="+encodeURIComponent(this.pageNumber.toString())),this.pageSize!==null&&this.pageSize.toString()&&e.push("pageSize="+encodeURIComponent(this.pageSize.toString())),this.sortField!==null&&this.sortField.toString()&&e.push("sortField="+encodeURIComponent(this.sortField.toString())),this.sortOrder!==null&&this.sortOrder.toString()&&e.push("sortOrder="+encodeURIComponent(this.sortOrder.toString())),e.join("&")}constructor(e=null){this.clone=()=>new a(this),this.customTypes=s.manageDefaultArrayValue(e,"customTypes",void 0),this.filter=s.manageDefaultValue(e,"filter",""),this.includeSubScanConfigurations=s.manageDefaultValue(e,"includeSubScanConfigurations",!1),this.inventoryScanType=e&&e.inventoryScanType?e.inventoryScanType:[],this.parentScanConfigurationID=s.manageDefaultValue(e,"parentScanConfigurationID",null),this.providers=s.manageDefaultArrayValue(e,"providers",void 0),this.key=s.manageDefaultValue(e,"key",""),this.pageNumber=s.manageDefaultValue(e,"pageNumber",0),this.pageSize=s.manageDefaultValue(e,"pageSize",0),this.sortField=s.manageDefaultValue(e,"sortField",""),this.sortOrder=s.manageDefaultValue(e,"sortOrder",1)}}});var b,k=v(()=>{w();A();b=(()=>{let e=class e{constructor(){this.viewRequestSource=new I,this.viewRequest=this.viewRequestSource.asObservable()}view(t){this.viewRequestSource.next(t)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=h({token:e,factory:e.\u0275fac,providedIn:"root"});let a=e;return a})()});var F,d,ae,K=v(()=>{w();O();_();F=C(q());x();G();B();P();d=C(Q());A();H();W();k();ae=(()=>{let e=class e extends N{constructor(t,r,o){super(),this.pamAssetServices=t,this.errorService=r,this.importResultDialogViewService=o}create(t){return new E({id:null,label:null,scanType:t?.scanType,active:!0,inProgress:!1,resultCount:0,scanNow:!0,providerTemplate:new V(t?.providerTemplate),frequencyValue:-1})}get(t){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfiguration(t))}getAll(t){let r=t||R.Deep;return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfigurations(r))}getAllWithPaging(t,r){let o=new f(g(g({},t),r));return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfigurationsList(o))}save(t){return this.handleError(this.saveData(t))}startScanNow(t){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_ScanNow(t))}delete(t){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_DeleteScanConfiguration(t).pipe(p(()=>!0)))}manageImportedAccountList(t,r,o){if(t.forEach(n=>{n.result&&n.result.hasSucceeded&&this.updateIsManagedStatus(r,n.userId)}),o){let n=d.groupBy(t,"userId");n=d.map(n,(l,y)=>({results:l}));let u={results:[]};n.forEach(l=>{let y=r.find(c=>c.id===l.results[0].userId)?.name,S="";l.results.filter(c=>!c.result.hasSucceeded).forEach(c=>S+=`- ${c.result.errorMessage} 
\r`),u.results.push({name:y,isSuccessful:S==="",errorMessage:S})}),this.importResultDialogViewService.view(u)}else this.importResultDialogViewService.view({results:t.map(n=>{let u=r.find(l=>l.id===n.userId);return{name:u?.username??u?.userPrincipalName??u?.name,isSuccessful:n.result.hasSucceeded,errorMessage:n.result.errorMessage}})})}updateIsManagedStatus(t,r){let o=t.find(n=>n.id===r);o&&(o.isManaged=!0)}saveData(t){return t.startDateTime=F.default.utc(t.startDateTime).toISOString(),t.id?this.pamAssetServices.AccountDiscoveryConfigurations_PutScanConfiguration(t.id,t).pipe(p(()=>t.id)):this.pamAssetServices.AccountDiscoveryConfigurations_PostScanConfiguration(t).pipe(p(r=>(r||{id:null}).id))}handleError(t,r=null){return t.pipe(T(o=>(this.errorService.handleError(o),D(r))))}};e.\u0275fac=function(r){return new(r||e)(m(U),m(M),m(b))},e.\u0275prov=h({token:e,factory:e.\u0275fac,providedIn:"root"});let a=e;return a})()});export{b as a,k as b,ae as c,K as d};
